Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.9.1
-
None
-
Windows 10, Qt 5.9.1 x64.
Description
Let's say there are two monitors A (100% scaling) and B (200% scaling) and your application uses Qt::AA_EnableHighDpiScaling.
Creating a window with a menu and opening this menu on monitor A looks fine.
Now move the window to monitor B and open the menu again:
The menu is way bigger than its content and the following error is logged:
QWindowsWindow::setGeometry: Unable to set geometry 414x252+4188+710 on QWidgetWindow/'QMenuClassWindow'. Resulting geometry: 662x403+4188+710 (frame: 0, 0, 0, 0, custom margin: 0, 0, 0, 0, minimum size: 0x0, maximum size: 16777215x16777215).
The same happens in reverse but the menu is cut off. Also, opening the menu again fixes it.
A small repro case:
#include <QApplication> #include <QtWidgets> class MenuWidget : public QMainWindow { public: MenuWidget() { auto fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction("Some File Menu Entry"); fileMenu->addAction("Some File Menu Entry"); fileMenu->addAction("Some File Menu Entry"); fileMenu->addAction("Some File Menu Entry"); fileMenu->addAction("Some File Menu Entry"); } }; int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication a(argc, argv); MenuWidget w; w.show(); return a.exec(); }
Attachments
Issue Links
- duplicates
-
QTBUG-59794 REG 5.9.x->5.12: Windows: Menus have wrong size when AA_EnableHighDpiScaling is set
- Closed