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

QMenu layout is wrong on the first invocation when opened on a secondary screen with the lower resolution

XMLWordPrintable

      On a multi-screen setup where the second monitor has a lower resolution than the primary screen, running the example and opening the menu on the second screen will result in an incorrect layout of the items the first time, and a correct layout of the items the second time.

      #include <QApplication>
      #include <QPushButton>
      #include <QMenu>

      int main(int argc, char *argv[])
      {
      QApplication app(argc,argv);

      QPushButton testButton;
      QMenu menu;
      for( int i = 0; i < 100; ++i )

      { menu.addAction( "Testaction " + QString::number( i ) ); }

      testButton.setMenu( &menu );
      testButton.show();
      return app.exec();
      }

      QMenuPrivate::calcActionRects calls QMenuPrivate::popupGeometry with the screen number on which the QMenu is before the menu has been positioned, which usually results in the primary screen size being used.

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

            bdo Jo Asplin (Inactive)
            vhilshei Volker Hilsheimer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes