Added some debug output

This commit is contained in:
Uwe Kindler 2018-10-11 13:07:27 +02:00
parent c3a5e3ef21
commit fc04aa2411
3 changed files with 18 additions and 8 deletions

View File

@ -182,7 +182,7 @@ void MainWindowPrivate::createContent()
ToolBar->addAction(ui.actionRestoreState); ToolBar->addAction(ui.actionRestoreState);
DockManager->addDockWidget(ads::BottomDockWidgetArea, FileSystemWidget); DockManager->addDockWidget(ads::BottomDockWidgetArea, FileSystemWidget);
FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu); /*FileSystemWidget = createFileSystemTreeDockWidget(ViewMenu);
ToolBar = FileSystemWidget->toolBar(); ToolBar = FileSystemWidget->toolBar();
ToolBar->addAction(ui.actionSaveState); ToolBar->addAction(ui.actionSaveState);
ToolBar->addAction(ui.actionRestoreState); ToolBar->addAction(ui.actionRestoreState);
@ -197,7 +197,7 @@ void MainWindowPrivate::createContent()
DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); DockManager->addDockWidget(ads::TopDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); auto BottomDockArea = DockManager->addDockWidget(ads::BottomDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea); DockManager->addDockWidget(ads::RightDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), RighDockArea);
DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea); DockManager->addDockWidget(ads::CenterDockWidgetArea, createLongTextLabelDockWidget(ViewMenu), BottomDockArea);*/
} }

View File

@ -199,11 +199,12 @@ public:
void setCurrentIndex(int index) void setCurrentIndex(int index)
{ {
std::cout << "setCurrentIndex" << std::endl; std::cout << "CDockAreaLayout::setCurrentIndex " << index << std::endl;
QWidget *prev = currentWidget(); QWidget *prev = currentWidget();
QWidget *next = widget(index); QWidget *next = widget(index);
if (!next || (next == prev && !m_CurrentWidget)) if (!next || (next == prev && !m_CurrentWidget))
{ {
std::cout << "return" << std::endl;
return; return;
} }
@ -629,6 +630,12 @@ void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget)
{ {
return; return;
} }
if (dockManager()->isRestoringState())
{
return;
}
setCurrentIndex(Index); setCurrentIndex(Index);
} }
@ -636,6 +643,7 @@ void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget)
//============================================================================ //============================================================================
void CDockAreaWidget::setCurrentIndex(int index) void CDockAreaWidget::setCurrentIndex(int index)
{ {
std::cout << "CDockAreaWidget::setCurrentIndex " << index << std::endl;
if (index < 0 || index > (d->TabBar->count() - 1)) if (index < 0 || index > (d->TabBar->count() - 1))
{ {
qWarning() << Q_FUNC_INFO << "Invalid index" << index; qWarning() << Q_FUNC_INFO << "Invalid index" << index;
@ -648,11 +656,8 @@ void CDockAreaWidget::setCurrentIndex(int index)
auto Features = CurrentTab->dockWidget()->features(); auto Features = CurrentTab->dockWidget()->features();
d->CloseButton->setVisible(Features.testFlag(CDockWidget::DockWidgetClosable)); d->CloseButton->setVisible(Features.testFlag(CDockWidget::DockWidgetClosable));
if (!dockManager()->isRestoringState())
{
d->ContentsLayout->setCurrentIndex(index); d->ContentsLayout->setCurrentIndex(index);
d->ContentsLayout->currentWidget()->show(); d->ContentsLayout->currentWidget()->show();
}
emit currentChanged(index); emit currentChanged(index);
} }

View File

@ -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 // 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 areas because the previous toggleView() action has changed
// the dock area index // the dock area index
std::cout << "Restoring dock container indexes" << std::endl;
int Count = 0;
for (auto DockContainer : Containers) 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) for (int i = 0; i < DockContainer->dockAreaCount(); ++i)
{ {
CDockAreaWidget* DockArea = DockContainer->dockArea(i); CDockAreaWidget* DockArea = DockContainer->dockArea(i);