From fc04aa241120f8cc1af8ceb4ba58deba6debb847 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 11 Oct 2018 13:07:27 +0200 Subject: [PATCH] Added some debug output --- demo/MainWindow.cpp | 4 ++-- src/DockAreaWidget.cpp | 17 +++++++++++------ src/DockManager.cpp | 5 +++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index fc04926..5afd9ed 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -182,7 +182,7 @@ void MainWindowPrivate::createContent() ToolBar->addAction(ui.actionRestoreState); DockManager->addDockWidget(ads::BottomDockWidgetArea, FileSystemWidget); - FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu); + /*FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu); ToolBar = FileSystemWidget->toolBar(); ToolBar->addAction(ui.actionSaveState); ToolBar->addAction(ui.actionRestoreState); @@ -197,7 +197,7 @@ void MainWindowPrivate::createContent() DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); - DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea); + DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);*/ } diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index a458a85..ebc6601 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -199,11 +199,12 @@ public: void setCurrentIndex(int index) { - std::cout << "setCurrentIndex" << std::endl; + std::cout << "CDockAreaLayout::setCurrentIndex " << index << std::endl; QWidget *prev = currentWidget(); QWidget *next = widget(index); if (!next || (next == prev && !m_CurrentWidget)) { + std::cout << "return" << std::endl; return; } @@ -629,6 +630,12 @@ void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget) { return; } + + if (dockManager()->isRestoringState()) + { + return; + } + setCurrentIndex(Index); } @@ -636,6 +643,7 @@ void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget) //============================================================================ void CDockAreaWidget::setCurrentIndex(int index) { + std::cout << "CDockAreaWidget::setCurrentIndex " << index << std::endl; if (index < 0 || index > (d->TabBar->count() - 1)) { qWarning() << Q_FUNC_INFO << "Invalid index" << index; @@ -648,11 +656,8 @@ void CDockAreaWidget::setCurrentIndex(int index) auto Features = CurrentTab->dockWidget()->features(); d->CloseButton->setVisible(Features.testFlag(CDockWidget::DockWidgetClosable)); - if (!dockManager()->isRestoringState()) - { - d->ContentsLayout->setCurrentIndex(index); - d->ContentsLayout->currentWidget()->show(); - } + d->ContentsLayout->setCurrentIndex(index); + d->ContentsLayout->currentWidget()->show(); emit currentChanged(index); } diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 9b964ba..c05afa3 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -254,8 +254,13 @@ bool DockManagerPrivate::restoreState(const QByteArray &state, int version) // Now all dock areas are properly restored and we setup the index of // The dock areas because the previous toggleView() action has changed // the dock area index + std::cout << "Restoring dock container indexes" << std::endl; + int Count = 0; for (auto DockContainer : Containers) { + Count++; + std::cout << "Restoring container " << Count << " floating: " + << DockContainer->isFloating() << " DockAreaCount " << DockContainer->dockAreaCount() << std::endl; for (int i = 0; i < DockContainer->dockAreaCount(); ++i) { CDockAreaWidget* DockArea = DockContainer->dockArea(i);