Fix dockwidgets behavior when window resized or central widgets is set.
When adding and showing a central widget in a QMainWindow then the layout does not respect the size policy of the central widget. This is a side effect of 059be19781a22d2e41f22072152589857d0fabf9 After the layout of QMainWindow is restored or the separator between central widget and dock widgets is moved by user, dock widgets should keep their size when the window if resized. Task-number: QTBUG-15689 Change-Id: Idfccb7b4ae057a99f431c2ed54e3b9fcfb6ef54c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
eb70933398
commit
b7915a4d0d
@ -2631,8 +2631,6 @@ void QDockAreaLayout::getGrid(QVector<QLayoutStruct> *_ver_struct_list,
|
||||
QSize bottom_max = docks[QInternal::BottomDock].maximumSize();
|
||||
bottom_hint = bottom_hint.boundedTo(bottom_max).expandedTo(bottom_min);
|
||||
|
||||
fallbackToSizeHints = false;
|
||||
|
||||
if (_ver_struct_list != 0) {
|
||||
QVector<QLayoutStruct> &ver_struct_list = *_ver_struct_list;
|
||||
ver_struct_list.resize(3);
|
||||
|
@ -232,7 +232,7 @@ public:
|
||||
QDockAreaLayout(QMainWindow *win);
|
||||
QDockAreaLayoutInfo docks[4];
|
||||
int sep; // separator extent
|
||||
bool fallbackToSizeHints; //determines if we should use the sizehint for the dock areas (true until the layout is restored or the central widget is set)
|
||||
bool fallbackToSizeHints; //determines if we should use the sizehint for the dock areas (true until the layout is restored or the separator is moved by user)
|
||||
mutable QVector<QWidget*> separatorWidgets;
|
||||
|
||||
bool isValid() const;
|
||||
|
@ -1351,6 +1351,8 @@ bool QMainWindowLayout::startSeparatorMove(const QPoint &pos)
|
||||
if (movingSeparator.isEmpty())
|
||||
return false;
|
||||
|
||||
layoutState.dockAreaLayout.fallbackToSizeHints = false;
|
||||
|
||||
savedState = layoutState;
|
||||
movingSeparatorPos = movingSeparatorOrigin = pos;
|
||||
|
||||
|
@ -1435,6 +1435,11 @@ void MoveSeparator::apply(QMainWindow *mw) const
|
||||
}
|
||||
QVERIFY(!path.isEmpty());
|
||||
|
||||
// For QTBUG-15689:
|
||||
// Following commands is used to simulate user move action. A better way should
|
||||
// use QMainWindowLayout::startSeparatorMove/separatorMove/endSeparatorMove,
|
||||
// but then we will need real start/end position coordinates.
|
||||
l->layoutState.dockAreaLayout.fallbackToSizeHints = false;
|
||||
l->layoutState.dockAreaLayout.separatorMove(path, QPoint(0, 0), QPoint(delta, delta));
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user