Setting Initial Width of QDockWidget in Qt 6 C++ Without Affecting Splitter Behavior
-
wrote on 18 Oct 2024, 04:02 last edited by
I'm working on a Qt 6 application where I need to set an initial width for a QDockWidget without disrupting the functionality of the splitter that separates multiple dock widgets within a QMainWindow.
I've tried using methods like dockWidget->setFixedSize() and dockWidget->setMaximumWidth(), but they either prevent the splitter from functioning properly or do not set the initial width as desired.What is the recommended way to set the initial width of a QDockWidget while still allowing it to be resizable via the splitter?
-
I'm working on a Qt 6 application where I need to set an initial width for a QDockWidget without disrupting the functionality of the splitter that separates multiple dock widgets within a QMainWindow.
I've tried using methods like dockWidget->setFixedSize() and dockWidget->setMaximumWidth(), but they either prevent the splitter from functioning properly or do not set the initial width as desired.What is the recommended way to set the initial width of a QDockWidget while still allowing it to be resizable via the splitter?
@NupurS What about https://doc.qt.io/qt-6/qsplitter.html#setStretchFactor ?
There is also https://doc.qt.io/qt-6/qwidget.html#resize-1
1/2