Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.11.2, 5.12.2, 5.12.3
-
None
-
macOS 10.12, 10.13, Xcode 10.
-
-
fccb519809d8e64db0e9cc54852c8612fe59b6c7 (qt/qtbase/5.13)
Description
The attached code demonstrates a problem with displaying a QMenu. I am using an iMac with a retina display on the left and an external monitor (regular DPI) to the right of the iMac. If I run the attached application and click the button to display the menu when the window is on the Retina display, the menu displays correctly, even if I allow it to close and click the button again.
If I move the window to the standard DPI display on the right and click the button, the menu pops up but all of the actions are invisible. If I hover over the actions, each action becomes visible as I hover over it.
If I then close the menu and pop it up again while the window is on either display, I still get this broken behavior.
I can reproduce this problem using the official build of 5.11.2 and 5.12.2, but not 5.9.6, on my machine running macOS 10.13. I'm building with Xcode 10.
The code to reproduce this is simply:
#include <QApplication> #include <QDialog> #include <QMenu> #include <QAction> #include <QToolButton> class TestDialog : public QDialog { Q_OBJECT public: TestDialog(QWidget* parent=nullptr) : QDialog(parent), theButton(new QToolButton(this)), theMenu(new QMenu(this)) { theButton->setText("Values"); theMenu->addAction("a"); theMenu->addAction("b"); theMenu->addAction("c"); // Make connection. connect(theButton, &QAbstractButton::clicked, this, [=]() { // Make sure that the button is drawn as being pressed (down). theButton->setDown(true); theMenu->exec(theButton->mapToGlobal(theButton->rect().bottomRight())); // Make sure that the button is drawn as being released (up). theButton->setDown(false); }); } private: QToolButton* theButton; QMenu* theMenu; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); TestDialog td; td.show(); return a.exec(); } #include "main.moc"
Attachments
Issue Links
- is duplicated by
-
QTBUG-77140 widget with flags popup and FramelessWindowHint does not paint
- Closed
- relates to
-
QTBUG-77066 Context menu on root node of project tree does not display correctly
- Closed
- resulted in
-
QTBUG-77350 QWidget does not handle spontaneous QPlatformWindow creation or destruction
- Closed