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

Qt Designer: Unable to set default QToolBar area

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.0 Alpha
    • 5.13.0 Beta2
    • Tools: Designer
    • None
    • Windows 10 Pro 1803

    • All
    • 409ee927e891122d86a788049dd9f04c92e1b731 (qt/qttools/dev)

    Description

      Using the Qt Creator, it is impossible to specify the default tool bar area to be different from Qt::TopToolBarArea.

      Steps to reproduce:

      • Create new Qt Widgets application from Qt Creator
      • Switch to designer
      • Create one or more actions; drop them into the pre-generated tool bar
      • Set allowed areas to Qt::LeftToolBarArea only (or Qt::LeftToolBarArea and Qt::RightToolBarArea only)

      Result: the tool bar will still be in the top area when starting the application.

      Details:

      The UI compiler generates the following code:

      toolBar->setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea);
      toolBar->setOrientation(Qt::Vertical);
      toolBar->setFloatable(false);
      mainWindow->addToolBar(Qt::TopToolBarArea, toolBar);
      

      I want to be able to specify the default area here, so that the last generated line can become something like:

      mainWindow->addToolBar(Qt::LeftToolBarArea, toolBar);
      

      Workaround

      There is a workaround for this problem, which involves manual correction code from the main windows constructor:

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent), ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
          this->removeToolBar(ui->toolBar);
          this->addToolBar(Qt::LeftToolBarArea, ui->toolBar);
          ui->toolBar->show();
      }
      

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            aschratt Carsten Rudolph
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes