Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.4.3
-
None
-
a210a1efb3a255235ab22e618c61d0aaccba3d9f
Description
When having a QToolButton with a menu embedded in a QGraphicsView then the menu may be popped up in the wrong location depending on the position of the tool button in the scene.
–
Example:
#include <QtGui> class widget : public QGraphicsView { public: widget(QWidget* parent = 0) : QGraphicsView(parent) { QGraphicsScene* scene = new QGraphicsScene(0, 0, 6000, 6000, this); setScene(scene); QToolButton* tb = new QToolButton; tb->setText("..."); QMenu* menu = new QMenu("&File"); menu->addAction("hello"); tb->setPopupMode(QToolButton::MenuButtonPopup); tb->setMenu(menu); QGraphicsProxyWidget* proxy = scene->addWidget(tb); tb->move(5900, 10); tb->show(); } }; int main(int argc, char **argv) { QApplication a(argc, argv); widget w; w.show(); return a.exec(); }
The problem also occurs with menus added to embedded QPushButtons:
#include <QtGui> class widget : public QGraphicsView { public: widget(QWidget* parent = 0) : QGraphicsView(parent) { QGraphicsScene* scene = new QGraphicsScene(); setScene(scene); QMenu * menu = new QMenu(); menu->addAction( "foo" ); QPushButton * button = new QPushButton( "Push Me" ); button->setMenu( menu ); QGraphicsProxyWidget* proxy = scene->addWidget(button); button->show(); } }; int main(int argc, char **argv) { QApplication a(argc, argv); widget w; w.show(); return a.exec(); }