Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-4246

Multiple context menus can be invoked from embedded widget

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.5.2
    • Widgets: GraphicsView
    • None

      Consider the following:

      A QPushButton with ActionsContextMenu policy is embedded into a graphics scene. When the right mouse button is pressed on the push button, its context menu is shown. However, if the user again presses the right mouse button on the part of the context menu that overlaps the push button, another context menu is invoked.

      This can be repeated several times to invoke multiple context menus.

      The following example reproduces the problem:

      #include <QtGui>
      
      class PushButton : public QPushButton
      {
          Q_OBJECT
      
      public:
          PushButton(QWidget *parent = 0) : QPushButton(parent)
          {
              setContextMenuPolicy(Qt::ActionsContextMenu);
              QAction *action = new QAction("Update text", this);
              addAction(action);
          }
      };
      
      #include "main.moc"
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          QGraphicsView view;
          QGraphicsScene *scene = new QGraphicsScene(0, 0, 800, 600);
          QGraphicsProxyWidget *proxy = scene->addWidget(new PushButton);
          view.setScene(scene);
          view.show();
      
          return app.exec();
      }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            menard Alexis Menard (closed Nokia identity) (Inactive)
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes