summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/QtGraphics_GDI.cxx9
-rw-r--r--vcl/qt5/QtSvpGraphics.cxx9
2 files changed, 16 insertions, 2 deletions
diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 0f9faa022d0b..f87de50827df 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -746,10 +746,17 @@ void QtGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
return;
}
- if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+ if (!m_pFrame)
+ return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+ if (!m_pFrame->GetQWidget()->window()->windowHandle())
return;
QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}
diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index b6018a95e299..3632c8990706 100644
--- a/vcl/qt5/QtSvpGraphics.cxx
+++ b/vcl/qt5/QtSvpGraphics.cxx
@@ -102,10 +102,17 @@ void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
return;
}
- if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+ if (!m_pFrame)
+ return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+ if (!m_pFrame->GetQWidget()->window()->windowHandle())
return;
QScreen* pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
}