diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-02-01 14:40:46 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-02-07 05:59:52 +0000 |
commit | fef6b31b994befac0ee14391572ebc2b9b33e104 (patch) | |
tree | 1b77313b284ede9a58802994694594229f19e128 | |
parent | 0307bfea31782512939aa4f97425b57cf35c080c (diff) |
GTK: fix menu positioning on high-DPI
The target position is passed in physical native pixels, so call
QPlatformWindow::mapToGlobal() instead of QWindow::mapToGlobal().
The latter operates on logical pixels.
Task-number: QTBUG-55251
Change-Id: I789128a0a345d4113fced82ed1b215fe14044634
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | src/plugins/platformthemes/gtk3/qgtk3menu.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp index 99407a21de..cdd1abaf7d 100644 --- a/src/plugins/platformthemes/gtk3/qgtk3menu.cpp +++ b/src/plugins/platformthemes/gtk3/qgtk3menu.cpp @@ -41,6 +41,7 @@ #include <QtGui/qwindow.h> #include <QtGui/qpa/qplatformtheme.h> +#include <QtGui/qpa/qplatformwindow.h> #undef signals #include <gtk/gtk.h> @@ -450,8 +451,9 @@ void QGtk3Menu::showPopup(const QWindow *parentWindow, const QRect &targetRect, m_targetPos = QPoint(targetRect.x(), targetRect.y() + targetRect.height()); - if (parentWindow) - m_targetPos = parentWindow->mapToGlobal(m_targetPos); + QPlatformWindow *pw = parentWindow ? parentWindow->handle() : nullptr; + if (pw) + m_targetPos = pw->mapToGlobal(m_targetPos); gtk_menu_popup(GTK_MENU(m_menu), NULL, NULL, qt_gtk_menu_position_func, this, 0, gtk_get_current_event_time()); } |