Reinstall the two QToolbars back to the same QToolbarArea

I am working on a Qt project where I need to get the positions of a toolbar at runtime. I used QMainWindow::toolBarArea(QToolBar *toolbar)

to get the current docking area of ​​the toolbar. And then I can use that later with QMainWindow::addToolBar ( Qt::ToolBarArea area, QToolBar * toolbar )

.

Suppose I am setting two toolbars in the same area (i.e. the bottom area) as shown below.

-----------------------------------
| Toolbar 1                       |
-----------------------------------
| Toolbar 2                       |
-----------------------------------

      

Then I save the region I got from QMainWindow::toolBarArea

using QSettings

and then load it with QMainWindow::addToolBar

, it loads like below.

-----------------------------------
| Toolbar 1      | Toolbar 2      |
-----------------------------------

      

Is there a way to reset their original shape without using it QMainWindow::saveState()

?

+3


source to share





All Articles