Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.2.10, 6.5.3, 6.6.1
-
Windows 10 22H2, MSVC 2019 x64
Description
Code
Adapted from https://doc.qt.io/qt-6/qml-qtquick-controls-menu.html#details
import QtQuick import QtQuick.Controls.Basic Window { width: 1600 height: 480 visible: true MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton onClicked: contextMenu.popup() Menu { id: contextMenu MenuItem { text: "Cut" } MenuItem { text: "Copy" } MenuItem { text: "Paste" } } } }
Steps to reproduce
- Set up 2 screens with different DPIs (e.g. 100% on Screen 1, 200% on Screen 2)
- Run the code above with -platform windows:dpiawareness=1 or -platform windows:dpiawareness=2
- While the window is contained within one screen only, right-click inside various parts of the window
- Move the window so that it spans both screens
- Right-click inside the window within the first screen
- Right-click inside the window within the second screen
Outcomes
- Step #3: The context menu always pops up at the mouse cursor (expected)
- Steps #5 and #6: The context menu pops up at the mouse cursor on one screen (expected), but pops up far away from the mouse cursor on the other screen (NOT expected)
Notes
- Which screen gets the wrong position depends on which screen the window is "adapted" to. The window changes size as you move it between screens and it "adapts" to the new DPI.
- If you repeat this test on Qt Creator or Microsoft Notepad or Mozilla Firefox, the context menu always pops up at the expected position.
Workaround
Run the code with dpiawareness=0. (This seems to be the opposite problem as QTBUG-102982 )