How to get the relationship between two QDockWidget?
-
In QMainWindow, I add two QDockWidget.I use the function
@
QMainWindow::splitDockWidget ( QDockWidget * first, QDockWidget * second, Qt::Orientation orientation )
@set the relationship of this two QDockWidget. But, how to get the relationship of this two QDockWidget, how should I do ?
-
relationship like this: Qt::Horizontal,Qt::Vertical. for example: one QDockWidget is on the rightside(Horizontal) of another.
or one QDockWidget is on the topside(Vertical) of another. -
well,my purpose is that when my application closing,i save all QDockwidget's state and achieve it to xml,then the next time application startup,i read the xml to get the state of all QDockwidget to restore the state.
-
Use "QMainWindow::saveState()":http://doc.trolltech.com/latest/qmainwindow.html#saveState and "QMainWindow::restoreState()":http://doc.trolltech.com/latest/qmainwindow.html#restoreState for that sorta thing.
-
[quote author="Franzk" date="1313503030"]Use "QMainWindow::saveState()":http://doc.trolltech.com/latest/qmainwindow.html#saveState and "QMainWindow::restoreState()":http://doc.trolltech.com/latest/qmainwindow.html#restoreState for that sorta thing.[/quote]
Indeed: that's why I asked :-)
-
I make a layout manager which can modify the achieved xml .This layout manager is for Users,Users can use manager layout QDockwidgets by their way. Then the application can layout QDockwidgets according the achieved xml.
-
QMainWindow::saveState() and restore function cant fit.
-
may be i have a bad english expression,i should study hard.
-
now, i can save QToolBar,QMenu state and restore them well,but cant restore QDockwidget well only.
For different users or industry, i support application with different layout. -
If all else fails: the sources of Qt are available to you. Check how saveState() and restoreState() are implemented, and perhaps you'll find something you can use. You might need to use undocumented or even expose private functionality to pull it off that way. Perhaps even a modification of Qt itself is needed. If you implement that nicely, you could try to have that merged in as a patch (if you can give a good use case for it).
-
Good idea. Actually I have saw the saveState() and restoreState() source code for several times. It is based on too much Qt's private implemention. It use many classes(not api) which derived from QLayout to implement this.I will continue to study.
-
ok