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

QMenu pops up on wrong screen

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical 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)

      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();
       }
      

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes