mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Fixed issue #378 - Don't show empty floating containers on startup
This commit is contained in:
parent
0df1a41a1d
commit
2afe62ec77
@ -466,6 +466,15 @@ void MainWindowPrivate::createContent()
|
||||
Action = ui.menuTests->addAction(QString("Raise %1").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
||||
|
||||
// Test hidden floating dock widget
|
||||
DockWidget = createLongTextLabelDockWidget();
|
||||
DockManager->addDockWidgetFloating(DockWidget);
|
||||
DockWidget->toggleView(false);
|
||||
|
||||
// Test visible floating dock widget
|
||||
DockWidget = createCalendarDockWidget();
|
||||
DockManager->addDockWidgetFloating(DockWidget);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
@ -1625,6 +1625,21 @@ QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CDockContainerWidget::hasOpenDockAreas() const
|
||||
{
|
||||
for (auto DockArea : d->DockAreas)
|
||||
{
|
||||
if (!DockArea->isHidden())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
||||
{
|
||||
|
@ -216,6 +216,13 @@ public:
|
||||
*/
|
||||
QList<CDockAreaWidget*> openedDockAreas() const;
|
||||
|
||||
/**
|
||||
* This function returns true, if the container has open dock areas.
|
||||
* This functions is a little bit faster than calling openedDockAreas().isEmpty()
|
||||
* because it returns as soon as it finds an open dock area
|
||||
*/
|
||||
bool hasOpenDockAreas() const;
|
||||
|
||||
/**
|
||||
* This function returns true if this dock area has only one single
|
||||
* visible dock widget.
|
||||
|
@ -762,7 +762,12 @@ void CDockManager::showEvent(QShowEvent *event)
|
||||
|
||||
for (auto FloatingWidget : d->UninitializedFloatingWidgets)
|
||||
{
|
||||
FloatingWidget->show();
|
||||
// Check, if someone closed a floating dock widget before the dock
|
||||
// manager is shown
|
||||
if (FloatingWidget->dockContainer()->hasOpenDockAreas())
|
||||
{
|
||||
FloatingWidget->show();
|
||||
}
|
||||
}
|
||||
d->UninitializedFloatingWidgets.clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user