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

Popup Menu from QToolButton opens in the primary monitor only.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 5.15.0
    • GUI: Menus
    • None
    • Windows

    Description

      With a two monitor setup (same monitors, same resolution on both: 1920x1080), QToolButton opens its menu in the primary monitor only, regardless which monitor has the application MainWindow. 

      The following minimal code reproduces this for me without a miss: 

      #include "mainwindow.h"
      #include <QToolBar>
      #include <QToolButton>
      #include <QMenu>
      
      MainWindow::MainWindow(QWidget *parent)
          : QMainWindow(parent)
      {
          QToolBar *tb = new QToolBar;
          addToolBar(tb);
      
          QToolButton *tool = new QToolButton;
          tb->addWidget(tool);
      
          tool->setText("Test tool");
          QMenu *menu = new QMenu(tool);
          tool->setMenu(menu);
          menu->addAction("Action 0");
          tool->setPopupMode(QToolButton::ToolButtonPopupMode::InstantPopup);
      }
      

       And the main function:

      #include "mainwindow.h"
      
      #include <QApplication>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          MainWindow w;
          w.resize(800, 600);
          w.show();
          return a.exec();
      }
      
      

       

      Attachments

        1. menu problem.jpg
          menu problem.jpg
          19 kB
        2. qtbug84462.zip
          3 kB

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              armans Arman S
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes