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

Popup Menu from QToolButton opens in the primary monitor only.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: GUI: Menus
    • Labels:
      None
    • Platform/s:
      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
          19 kB
          Arman S
        2. qtbug84462.zip
          3 kB
          Friedemann Kleint

          Issue Links

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

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes