QMainWindow: fix potential assert when restoring dock widget state
Don't append separator widgets at the end if their slot in the list is still free. Pick-to: 6.5 Task-number: QTBUG-111538 Change-Id: Id9ada2c083345cfd69633e506cceedc9ae6f2ae4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
8f8be55c15
commit
5b8ffc6d2a
@ -1989,14 +1989,20 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
|
||||
break;
|
||||
|
||||
QWidget *sepWidget;
|
||||
if (j < separatorWidgets.size() && separatorWidgets.at(j)) {
|
||||
if (j < separatorWidgets.size()) {
|
||||
sepWidget = separatorWidgets.at(j);
|
||||
if (!sepWidget) {
|
||||
qWarning("QDockAreaLayoutInfo::updateSeparatorWidgets: null separator widget");
|
||||
sepWidget = mainWindowLayout()->getSeparatorWidget();
|
||||
separatorWidgets[j] = sepWidget;
|
||||
}
|
||||
} else {
|
||||
sepWidget = mainWindowLayout()->getSeparatorWidget();
|
||||
separatorWidgets.append(sepWidget);
|
||||
}
|
||||
j++;
|
||||
|
||||
Q_ASSERT(sepWidget);
|
||||
sepWidget->raise();
|
||||
|
||||
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
|
||||
@ -2009,7 +2015,6 @@ void QDockAreaLayoutInfo::updateSeparatorWidgets() const
|
||||
separatorWidgets[k]->hide();
|
||||
}
|
||||
separatorWidgets.resize(j);
|
||||
Q_ASSERT(separatorWidgets.size() == j);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@ -3271,12 +3276,18 @@ void QDockAreaLayout::updateSeparatorWidgets() const
|
||||
QWidget *sepWidget;
|
||||
if (j < separatorWidgets.size()) {
|
||||
sepWidget = separatorWidgets.at(j);
|
||||
if (!sepWidget) {
|
||||
qWarning("QDockAreaLayout::updateSeparatorWidgets: null separator widget");
|
||||
sepWidget = qt_mainwindow_layout(mainWindow)->getSeparatorWidget();
|
||||
separatorWidgets[j] = sepWidget;
|
||||
}
|
||||
} else {
|
||||
sepWidget = qt_mainwindow_layout(mainWindow)->getSeparatorWidget();
|
||||
separatorWidgets.append(sepWidget);
|
||||
}
|
||||
j++;
|
||||
|
||||
Q_ASSERT(sepWidget);
|
||||
sepWidget->raise();
|
||||
|
||||
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user