| author | Axel Spoerl <axel.spoerl@qt.io> | 2022-12-16 10:37:00 +0100 |
|---|---|---|
| committer | Axel Spoerl <axel.spoerl@qt.io> | 2022-12-19 21:16:38 +0100 |
| commit | ff83fc75901527c0c14c481dbe9929129942c5b9 (patch) | |
| tree | 1642fcd86cdb8d8b7433cecdb67bc67cbc2f67a0 | |
| parent | 13053d455ec3ff114d08795a63dae130b57d1578 (diff) | |
| -rw-r--r-- | src/widgets/widgets/qtoolbar.cpp | 8 |
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index ae0414e776..b5950fdf23 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -24,6 +24,7 @@ #include <qtimer.h> #include <private/qwidgetaction_p.h> #include <private/qmainwindowlayout_p.h> +#include <private/qhighdpiscaling_p.h> #ifdef Q_OS_MACOS #include <qpa/qplatformnativeinterface.h> @@ -309,7 +310,12 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) const QPoint globalPressPos = q->mapToGlobal(q->isRightToLeft() ? rtl : state->pressPos); int pos = 0; - QPoint delta = event->globalPosition().toPoint() - globalPressPos; + const QWindow *handle = q->window() ? q->window()->windowHandle() : nullptr; + const QPoint delta = handle + ? QHighDpi::fromNativePixels(event->globalPosition(), handle).toPoint() + - QHighDpi::fromNativePixels(globalPressPos, handle) + : event->globalPosition().toPoint() - globalPressPos; + if (orientation == Qt::Vertical) { pos = q->y() + delta.y(); } else { |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

