Solved I can't set state for QMainWindow
-
Hi!
I have 2 QMainWindow in my program. For first QMainWindow I can set state for QMainWindow, but for second QMainWindow restoreState() not work. Second QMainWindow at the start I create 2 QDockWidget. How save state 2 QDockWidget from from second QMainWindow? -
@Mikeeeeee How do you store the state of both QMainWindow? And why do you have two QMainWindow in your app?
-
@jsulm said in I can't set state for QMainWindow:
How do you store the state of both QMainWindow? And why do you have two QMainWindow in your app?
I hove 2 QMainWindow becouse me need use QDockWidget in centr my window. I wont use QMainWindow::saveState() and QMainWindow::restoreState(). For first QMainWindow it's work.
-
@Mikeeeeee Did you see this in the documentation:
"The objectName property is used to identify each QToolBar and QDockWidget. You should make sure that this property is unique for each QToolBar and QDockWidget you add to the QMainWindow"?
https://doc.qt.io/qt-5/qmainwindow.html#saveState
Did you make sure your QToolBars and QDockWidgets have unique names? -
They are unique, otherwise I wouldn't be able to add them.
-
-
The name of each object is unique.
-
@Mikeeeeee To make sure we are talking about same thing: I'm talking about https://doc.qt.io/qt-5/qobject.html#objectName-prop, not variable names.
-
Thanks! I didn't specify the name of the objects.