Details
-
Suggestion
-
Resolution: Done
-
P3: Somewhat important
-
5.13.0 Beta2
-
None
-
Windows 10 Pro 1803
-
-
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(); }