Added DockWidgetBase::isOverlayed()

This commit is contained in:
Sergio Martins
2020-09-20 13:48:17 +01:00
parent 2659ddb76b
commit 54b28c42e2
4 changed files with 21 additions and 0 deletions

View File

@@ -497,6 +497,14 @@ void DockWidgetBase::moveToSideBar()
}
}
bool DockWidgetBase::isOverlayed() const
{
if (MainWindowBase *m = mainWindow())
return m->overlayedDockWidget() == this;
return false;
}
FloatingWindow *DockWidgetBase::morphIntoFloatingWindow()
{
qCDebug(creation) << "DockWidget::morphIntoFloatingWindow() this=" << this

View File

@@ -349,6 +349,10 @@ public:
*/
void moveToSideBar();
/// @brief Returns whether this dock widget is overlayed on top of the main window, instead of
/// docked into the layout. This is only relevant when using the auto-hide and side-bar feature.
bool isOverlayed() const;
Q_SIGNALS:
///@brief signal emitted when the parent changed
void parentChanged();

View File

@@ -293,6 +293,11 @@ SideBar *MainWindowBase::sideBarForDockWidget(DockWidgetBase *dw) const
return nullptr;
}
DockWidgetBase *MainWindowBase::overlayedDockWidget() const
{
return d->m_overlayedDockWidget;
}
void MainWindowBase::setUniqueName(const QString &uniqueName)
{
if (uniqueName.isEmpty())

View File

@@ -155,6 +155,10 @@ public:
/// @brief Returns the sidebar this dockwidget is in. nullptr if not in any.
SideBar * sideBarForDockWidget(DockWidgetBase *) const;
/// @brief returns the dock widget which is currently overlayed. nullptr if none.
/// This is only relevant when using the auto-hide and side-bar feature.
DockWidgetBase *overlayedDockWidget() const;
protected:
void setUniqueName(const QString &uniqueName);