How do I set the initial width of a QDockWidget?
I have implemented the sizeHint function but what next?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The documentation for QDockWidget says:
So the size hint is taken from whatever you put in the dock widget. Have you tried setting the size of the
QDockWidget‘s child?But, I agree with Marius, the best thing to do is probably to use
QSettingsto save and restore the widths of all the dock windows when the application starts. Have a look at QMainWindow::saveState.Apart from getting the data from
saveStaterather than from individual functions, my save function looks very similar to the one given by Marius.