[vlmc-devel] [PATCH 2/4] MainWindow: Set objectName of dockWidget(s)

Yikai Lu luyikei.qmltu at gmail.com
Fri Apr 29 10:05:44 CEST 2016


When we want to call QMainWindow::saveState(), we have to ensure the following:

"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"
---
 src/Gui/MainWindow.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 6ab17fa..fe68245 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -649,6 +649,7 @@ MainWindow::dockWidget( QWidget* widget, Qt::DockWidgetArea startArea )
     dock->setAllowedAreas( Qt::AllDockWidgetAreas );
     widget->setParent( dock );
     dock->setWidget( widget );
+    dock->setObjectName( widget->objectName() );
     addDockWidget( startArea, dock );
     registerWidgetInWindowMenu( dock );
     return dock;
-- 
1.9.1



More information about the Vlmc-devel mailing list