Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
6.2.2
Description
There is a menu sizing issue that can happen in Qt 6.2.2 (compared to Qt 5.14.1) on Windows 10 with external monitors with different scaling settings. When a menu is first created, it appears that "windowsvista" styling initially picks the wrong screen scaling context to determine the height of the menu. After a menu has been shown once, as long as that menu object persists, subsequent calls to show that menu now have the correct height (presumably from the correct screen context).
I've included sample source to demonstrate the issue (based on Qt5.14.1\Examples\Qt-5.14.1\widgets\mainwindows\menus).
Configuration of my build machine:
Qt Creator 6.0.2 with kits for Qt 6.2.2 and Qt 5.14.1.
Windows 10 Pro, version 21H1, build 19043.1586.
Intel Latitide laptop, main screen (#1) 1366x768 100% scaling (recommended), external monitor (#2) 1920x1200 125% scaling (not the recommended 100%).
Things to note:
The issue seems tied to the style "windowsvista" (see main.cpp, line 60). Perhaps the bug is in "styles\qwindowvistastyle.dll".
Menu objects that persist (see mainwindow.h lines 112-115) only show the issue the first time they are displayed but not subsequent times.
Calls to QMenu::popup() (see mainwindow.cpp line 142) reproduce the issue but calls to QMenu::exec() (see mainwindow.cpp line 121) do not.
The default context menu for widgets such as QLineEdit show the issue (see mainwindow.cpp line 82).
The menu sizing behavior depends on which monitor the app is running on.
Methods to reproduce the issue in the included sample:
NOTE: The menu sizing behavior will depend on which monitor the app is running on. The methods described below assume the app is on screen #1 at 100% scaling while external screen #2 has different scaling.
1. Left click once on "File" menu, while holding mouse position. Notice that the bottom of the "File" menu is clipped short. Move mouse to right over the "Edit" menu. Notice that the bottom of this menu is also clipped. Move the mouse down the menu to the bottom item called "Format" (hard to see because it is clipped) to make the submenu show. Notice that the submenu is clipped at the bottom. Move the mouse upwards over the "Paste" item then back down over the "Format" item. Notice that the submenu has fixed it sizing so that the bottom item is no longer clipped. Move the mouse upwards over "Edit" in menu bar then left over the "File" menu. Notice that the "File" menu is now sized correctly.
2. Right click in the upper gray area of the app. Notice that the context menu is sized correctly. Move mouse downwards over the "SubMenu" item. Notice that the submenu is clipped at the bottom. Move the mouse upwards over the "Paste" item and then back down over the "SubMenu" item. Notice that the submenu is now sized correctly.
3. Right click on the label "Choose a menu item..." in middle of app. Notice that the context menu is clipped at the bottom (unlike in method #2). However, the submenu will still be clipped like it is in method #2.
4. Right click on the line edit box in the middle of the app. Notice that the default context menu for QlineEdit is clipped at the bottom.
Attachments
Issue Links
- relates to
-
QTBUG-103309 Menus can be truncated (REG from 5.15.2)
- Reported
For Gerrit Dashboard: QTBUG-101947 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
411657,7 | Fix QWidget::metric to use widget screen dpr instead of app-dpr | dev | qt/qtbase | Status: MERGED | +2 | 0 |