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

Wrong menu position for QToolButton placed on a scene

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.6.0
    • Widgets: GraphicsView
    • None
    • Ubuntu 16.04 64 bit
    • 474af0a61d6154006966a775d186687aa8881708 (qtbase/5.6, 14.5.2016, 5.6.1)

    Description

      Please see screenshot. With Qt 5.5.1 all works as expected. Example to reproduce:

      #include <QApplication>
      #include <QHBoxLayout>
      #include <QMenu>
      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QToolButton>
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QToolButton* btn = new QToolButton;
          QMenu* m = new QMenu;
          m->addAction( "test" );
          btn->setMenu( m );
          btn->setPopupMode( QToolButton::InstantPopup );
      
          QWidget* const w = new QWidget;
          QHBoxLayout* const l = new QHBoxLayout;
          l->addWidget( btn );
          w->setLayout( l );
      
          QGraphicsScene scene;
          scene.addWidget( w );
      
          QGraphicsView graphicsView;
          graphicsView.setScene(&scene);
      
          graphicsView.show();
      
          return app.exec();
      }
      

      Attachments

        1. 0001-fix-menu.patch
          2 kB
        2. 1404_551.png
          1404_551.png
          835 kB
        3. main.cpp
          0.7 kB
        4. qtbug.pro
          0.3 kB
        5. qtbug52507.zip
          1 kB
        6. scale.png
          scale.png
          185 kB
        7. scr.png
          scr.png
          2.05 MB
        8. scr2.png
          scr2.png
          1.15 MB

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              igornikitin Igor
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes