summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformwindow.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-05-27 10:57:08 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-10-20 07:26:24 +0200
commit95bce5b185ddc736405a952b9132e5c8f51275aa (patch)
tree0f3c542dade9d5dbfa7aaec86591159d55221c41 /src/gui/kernel/qplatformwindow.cpp
parent73a93981ca6bd641f2c75faf3cdce1fa0711fbb5 (diff)
QHighDpi: window geometry scaling functions
Add functions which scales window geometry: framNativeWindowGeometry() toNativeWindowGeometry() These correctly handles top-level and child windows, where top-level window positions scale around the screen origin while child window positions scale around (0, 0). Modify call cites to use the new functions. We no longer need the isTopLevel checks at the call site. Change-Id: I0158672d46a3f52dfc7d37d021fc5cebd7859200 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r--src/gui/kernel/qplatformwindow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 4b7d7f5b7e..f9e984c9cb 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -849,7 +849,7 @@ QSize QPlatformWindow::windowSizeIncrement() const
*/
QRect QPlatformWindow::windowGeometry() const
{
- return QHighDpi::toNativePixels(window()->geometry(), window());
+ return QHighDpi::toNativeWindowGeometry(window()->geometry(), window());
}
/*!
@@ -857,7 +857,7 @@ QRect QPlatformWindow::windowGeometry() const
*/
QRect QPlatformWindow::windowFrameGeometry() const
{
- return QHighDpi::toNativePixels(window()->frameGeometry(), window());
+ return QHighDpi::toNativeWindowGeometry(window()->frameGeometry(), window());
}
/*!
@@ -868,10 +868,10 @@ QRect QPlatformWindow::windowFrameGeometry() const
QRectF QPlatformWindow::closestAcceptableGeometry(const QWindow *qWindow, const QRectF &nativeRect)
{
- const QRectF rectF = QHighDpi::fromNativePixels(nativeRect, qWindow);
+ const QRectF rectF = QHighDpi::fromNativeWindowGeometry(nativeRect, qWindow);
const QRectF correctedGeometryF = qt_window_private(const_cast<QWindow *>(qWindow))->closestAcceptableGeometry(rectF);
return !correctedGeometryF.isEmpty() && rectF != correctedGeometryF
- ? QHighDpi::toNativePixels(correctedGeometryF, qWindow) : nativeRect;
+ ? QHighDpi::toNativeWindowGeometry(correctedGeometryF, qWindow) : nativeRect;
}
QRectF QPlatformWindow::windowClosestAcceptableGeometry(const QRectF &nativeRect) const