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

QMenu pops up on wrong screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.2.5, 6.3.1, 6.4.0 Beta1
    • 6.2.0
    • QPA: Windows
    • None
    • 2 screens, Primary - 1080p 17inch laptop. Secondary - 32 inch 1440p external monitor
    • Windows
    • 58d4645661 (qt/qtbase/dev) daabed5107 (qt/qtbase/6.3) daabed5107 (qt/tqtc-qtbase/6.3) 43ab2d4966 (qt/tqtc-qtbase/6.2)

    Description

      QMenu always pops up on the primary screen, regardless of popup cordintates
      Attached is the code to reproduce, the code works fine with qt 5.15 but not with qt 6.2

       #include <QApplication>
       #include <QPushButton>
       #include <QMenu>
       #include <QAction>
      
      int main(int argc, char *argv[])
       {
       QApplication a(argc, argv);
       QWidget w;
      
      auto b = new QPushButton(&w);
       QObject::connect(b, &QPushButton::clicked, &w, [b](bool)
      
      { auto m = new QMenu(b); m->addAction("action 1"); m->popup(b->mapToGlobal(QPoint(0, b->height()))); }
      
      );
      
      w.show();
       return a.exec();
       }
      

      Attachments

        1. qtdiag.txt
          12 kB
          Prince Gupta
        2. video-2021-10-26 11-17PM.mp4
          534 kB
          Prince Gupta

        Issue Links

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

          Activity

            People

              anrocha André De La Rocha (Inactive)
              jagannatharjun Prince Gupta
              Votes:
              2 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes