Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.3.2, 5.4.2, 5.5.0
-
None
-
Windows 7, GNU/Linux
Description
When having one or multiple QMenu embedded inside a QGraphicsScene (or as children of an embedded widget) they are sometimes not shown at the right position when opened. Also, the transition from one opened menu to another without clicking, in a QMenuBar for instance, does not work.
Code to reproduce :
#include <QApplication> #include <QMenu> #include <QMenuBar> #include <QGraphicsScene> #include <QGraphicsView> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMenuBar* bar = new QMenuBar; // Populate : QMenu* a1 = bar->addMenu("a1"); a1->addMenu("b1")->addAction("c1"); a1->addMenu("b2")->addAction("c2"); QMenu* a2 = bar->addMenu("a2"); a2->addMenu("b1")->addAction("c1"); a2->addMenu("b2")->addAction("c2"); QGraphicsScene scene; QGraphicsProxyWidget* proxy = scene.addWidget(bar); QGraphicsView graphicsView; graphicsView.setScene(&scene); // To get a larger window : //graphicsView.setSceneRect(0, 0, 500, 500); //graphicsView.resize(512, 512); graphicsView.show(); return app.exec(); }
The documentation of QGraphicsProxyWidget has the following warning :
"This only works if the popup is child of the embedded widget". If it applies to the previous example, it would be nice to have more details in the documentation about it then.