PDA

View Full Version : How disable "QDockWidget expanding" when QMainWindow resize



Alundra
2nd January 2015, 21:37
Hi all,
I have a QMainWindow, I init it with two docks on the right area and at the end I show maximized.
The problem is when the main window is showed maximized the two dock has the same height.
Is it possible to have the bottom dock stays at the same height when the main window resize ?
I have the same issue on the bottom dock area, I would have the first stays at the same width.
How to achieve this result ?
Thanks for the help

NIteLordz
3rd January 2015, 02:40
Do you want the dock widget to stay the same size all the time, meaning it is not resizable, even when QMainWindow is not maximized ? If so, then you can set the QSizePolicy::Fixed for height, and that dock window will not change size, ever.

If you still want it to be able to be resized, but have only the top window expand, while the bottom one stays the same, then i think you want to set the QSizePolicy::Minimum

You can learn more about the QSizePolicy and how they affect widgets here (http://doc.qt.io/qt-5/qsizepolicy.html)

Alundra
3rd January 2015, 05:48
I want it to be able to be resized. The QUndoView is the bottom widget.


QUndoView* UndoView = new QUndoView( MainEditorUndoStack, this );
UndoView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
m_UndoHistoryDock->setWidget( UndoView );

This code has no effect, setSizePolicy on the dock has no effect too.