How to resize the QDockWidget?
-
I cant find the way to resize a QDockWidget in QMainWindow.
-
You can use "resize":http://doc.qt.nokia.com/latest/qwidget.html#size-prop
-
The function QWidget::resize() is no use for QDockWidget which in QMainWindow.Because QDockWidget controled by the Layout of QMainWindow.
-
[quote author="yunxiaodong" date="1313485153"]The function QWidget::resize() is no use for QDockWidget which in QMainWindow.Because QDockWidget controled by the Layout of QMainWindow.[/quote]
Yes, you are right when QDockWidget in layout resize() don't work it work only if the widgets are floating (i.e. not docked). Sorry for misunderstanding. -
I don't know what you want to do exactly.
you could try
setminimumsize() -
In my application, input width and height,and I set the dockwidget use this two pama.
-
Does it mean that when you alter these parameters, the contents of your dockwidget changes? eg. more widgets, longer text in widgets...It seems strange to handle sizes this way.Since you are in a layout the contents of the widgets will drive the size of the dock.
Can you elaborate some more on your usecase? Why do you want the sizes to change using these parameters?
-
When my application closing, I save the current state of this mainwindow's dockwidgets to xml, next time the app start up, i restore the state of this mainwindow's dockwidgets accroding xml.
-
form the "docs :":http://doc.qt.nokia.com/4.7/qmainwindow.html#storing-state
Storing StateQMainWindow can store the state of its layout with saveState(); it can later be retrieved with restoreState(). It is the position and size (relative to the size of the main window) of the toolbars and dock widgets that are stored.
-
yes,you side it. I knew this method before,but saveState() cant get more details. i need more details,such as toolbar name, detail of every action in toolbar and so on. so i must realize by myself. my application is framework-plugin.