Changed store and restore functioality to save the current dock widget name of an dock area instead of the current index because if some dock widgets are missing when loading the configuration, the dock index might be wrong
This commit is contained in:
@@ -269,15 +269,12 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version)
|
||||
for (int i = 0; i < DockContainer->dockAreaCount(); ++i)
|
||||
{
|
||||
CDockAreaWidget* DockArea = DockContainer->dockArea(i);
|
||||
int CurrentIndex = DockArea->property("currentIndex").toInt();
|
||||
int DockWidgetCount = DockArea->dockWidgetsCount();
|
||||
if (CurrentIndex < DockWidgetCount && DockWidgetCount > 1 && CurrentIndex > -1)
|
||||
QString DockWidgetName = DockArea->property("currentDockWidget").toString();
|
||||
CDockWidget* DockWidget = _this->findDockWidget(DockWidgetName);
|
||||
std::cout << "restore DockWIdgetName " << DockWidget->objectName().toStdString() << std::endl;
|
||||
if (!DockWidget->isClosed())
|
||||
{
|
||||
auto DockWidget = DockArea->dockWidget(CurrentIndex);
|
||||
if (!DockWidget->isClosed())
|
||||
{
|
||||
DockArea->setCurrentIndex(CurrentIndex);
|
||||
}
|
||||
DockArea->internalSetCurrentDockWidget(DockWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user