summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-07-20 08:19:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-08-02 08:13:15 +0200
commitb6b26421a1029b18b48b69dbdac4bb70fb622604 (patch)
tree97b9ab25fef28063a3de4e3a67544d2ea13a70e0 /vcl/qt5
parentd66ffef8558785f19908c8e526211b8225fa9125 (diff)
split Point/Size/Rectangle into AbsoluteScreenPixel* types
to attempt to make it obvious in code what kind of coordinate system we are dealing with. The idea is that by doing this, the compile-time type checking will flush out inconsistencies between different code. I started with vcl::Window::OutputToAbsoluteScreenPixel and worked outwards from there. Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtFrame.cxx4
-rw-r--r--vcl/qt5/QtMenu.cxx2
-rw-r--r--vcl/qt5/QtSystem.cxx4
3 files changed, 5 insertions, 5 deletions
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 0bd436266714..5c9947922f47 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -591,7 +591,7 @@ void QtFrame::GetClientSize(tools::Long& rWidth, tools::Long& rHeight)
rHeight = round(m_pQWidget->height() * devicePixelRatioF());
}
-void QtFrame::GetWorkArea(tools::Rectangle& rRect)
+void QtFrame::GetWorkArea(AbsoluteScreenPixelRectangle& rRect)
{
if (!isWindow())
return;
@@ -600,7 +600,7 @@ void QtFrame::GetWorkArea(tools::Rectangle& rRect)
return;
QSize aSize = pScreen->availableVirtualSize() * devicePixelRatioF();
- rRect = tools::Rectangle(0, 0, aSize.width(), aSize.height());
+ rRect = AbsoluteScreenPixelRectangle(0, 0, aSize.width(), aSize.height());
}
SalFrame* QtFrame::GetParent() const { return m_pParent; }
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index b1e62bc09475..cd42139e713b 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -885,7 +885,7 @@ bool QtMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& r
mpQMenu->setTearOffEnabled(bool(nFlags & FloatWinPopupFlags::AllowTearOff));
const VclPtr<vcl::Window> xParent = pWin->ImplGetWindowImpl()->mpRealParent;
- tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect);
+ AbsoluteScreenPixelRectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect);
// tdf#154447 Menu bar height has to be added
QtFrame* pFrame = static_cast<QtFrame*>(pWin->ImplGetFrame());
diff --git a/vcl/qt5/QtSystem.cxx b/vcl/qt5/QtSystem.cxx
index 5f5f4ad284e5..d43e47832faa 100644
--- a/vcl/qt5/QtSystem.cxx
+++ b/vcl/qt5/QtSystem.cxx
@@ -16,10 +16,10 @@
unsigned int QtSystem::GetDisplayScreenCount() { return QGuiApplication::screens().size(); }
-tools::Rectangle QtSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen)
+AbsoluteScreenPixelRectangle QtSystem::GetDisplayScreenPosSizePixel(unsigned int nScreen)
{
QRect qRect = QGuiApplication::screens().at(nScreen)->geometry();
- return toRectangle(scaledQRect(qRect, qApp->devicePixelRatio()));
+ return AbsoluteScreenPixelRectangle(toRectangle(scaledQRect(qRect, qApp->devicePixelRatio())));
}
int QtSystem::ShowNativeDialog(const OUString&, const OUString&, const std::vector<OUString>&)