Friday, July 4th 2008, 9:20pm UTC+1

You are not logged in.

  • Login
  • Register

stinny

Beginner

Posts: 26

Location: Prague

Occupation: CS student

1

Friday, April 11th 2008, 7:09pm

Saving state of DockWidgets

Is there any way to completely save and restore the state of many QDockWidgets (visibility, floatingness, docking corner, size and position against other docks, tabs ...)?
I tried to store the properties size, pos and the last dock area, the QDockWidgets are on the correct side of QMainWindow, but not tabbed, neither their size nor order is preserved, they are not tabbed.
Has anyone successfully solved this problem? I think it is important to have the application user-friendly, especially when using many DockWidgets.
  • Go to the top of the page

2

Saturday, April 12th 2008, 12:50pm

RE: Saving state of DockWidgets

what is your system?
did you use QSettings?
...

show some pices of code to see what you do, so we can give you some indications
Nicolas
  • Go to the top of the page

stinny

Beginner

Posts: 26

Location: Prague

Occupation: CS student

3

Monday, April 14th 2008, 4:57pm

RE: Saving state of DockWidgets

I use Ubuntu and I haven't got an opportunity to try it on Windows yet.

I've made a convenience class DockWidget (instead of QDockWidget), which gets a pointer to its child in its constructor, as well as the section name in settings (only in the first c-tor). Below I attached the whole code. gSettings is a global object of type QSettings.

Thank You for Your time, ask me if You need further information.
stinny has attached the following files:
  • dockwidget.h (705 Byte - 8 times downloaded - Last download: Jun 17th 2008, 2:33pm)
  • dockwidget.cpp (2.1 kB - 9 times downloaded - Last download: Yesterday, 3:52am)
  • Go to the top of the page

stinny

Beginner

Posts: 26

Location: Prague

Occupation: CS student

4

Wednesday, May 7th 2008, 2:15pm

I finally figured it out, it is easy, but I have missed it on the first time :)

for those who are interested:

1) Create QDockWidgets and QToolbars desired.
2) Assign each of them an unique objectName.
3) Call QMainWindow::restoreState( const QByteArray & array ).

In the destructor, call QByteArray QMainWindow::saveState();

The QByteArray could be stored in QSettings, regular file, etc.
  • Go to the top of the page

Rate this thread