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

Objects added using QToolBar::addWidget() are not shown in the popup menu.

    XMLWordPrintable

Details

    • macOS

    Description

      First, we could workaround the menu popup on OS X by applying qtoolbarlayout.cpp.patch file. The example can be reproduced using the attached opengl_hellogl_main.cpp.patch against the HelloGL project of OpenGL examples.

          QToolBar* tb = mainWindow.addToolBar("File");
          tb->addAction("Dummy1");
          tb->addAction("Dummy2");
          tb->addAction("Dummy3");
          tb->addAction("Dummy4");
          tb->addAction("Dummy5");
          tb->addAction("Dummy6");
          tb->addAction("Dummy7");
          tb->addAction("Dummy8");
          tb->addAction("Dummy9");
          tb->addAction("Dummy10");
          tb->addAction("Dummy11");
          tb->addAction("Dummy12");
          tb->addAction("Dummy13");
          tb->addAction("Dummy14");
          tb->addAction("Dummy15");
      
          QToolButton* toolButton = new QToolButton;
          toolButton->setText("ToolButton");
          toolButton->setPopupMode(QToolButton::MenuButtonPopup);
      
          QAction *fooAction = new QAction("Foo",&mainWindow);
          QWidgetAction * widgetAction = new QWidgetAction(&mainWindow);
          widgetAction->setText("Bar");
          FooWidgetAction *fooWidgetAction = new FooWidgetAction(&mainWindow);
      
          QMenu* buttonMenu = new QMenu(toolButton);
          buttonMenu->addAction(fooAction);
          buttonMenu->addAction(widgetAction);
          buttonMenu->addAction(fooWidgetAction);
          toolButton->setMenu(buttonMenu);
      
          tb->addWidget(toolButton);
      

      The bug can only be reproduce on OS X system.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            leonlee Leonard Lee
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes