Added DockWidget functions setAsCurrentTab, raise, isCurrentTab, isTabbed

This commit is contained in:
Uwe Kindler
2020-04-13 22:16:47 +02:00
parent a668fe2f73
commit 8aae6bf70b
5 changed files with 91 additions and 7 deletions

View File

@@ -44,6 +44,7 @@
#include <QDebug>
#include <QToolBar>
#include <QXmlStreamWriter>
#include <QWindow>
#include <QGuiApplication>
#include <QScreen>
@@ -918,6 +919,49 @@ bool CDockWidget::isFullScreen() const
}
//============================================================================
void CDockWidget::setAsCurrentTab()
{
if (d->DockArea && !isClosed())
{
d->DockArea->setCurrentDockWidget(this);
}
}
//============================================================================
bool CDockWidget::isTabbed() const
{
return d->DockArea && (d->DockArea->openDockWidgetsCount() > 1);
}
//============================================================================
bool CDockWidget::isCurrentTab() const
{
return d->DockArea && (d->DockArea->currentDockWidget() == this);
}
//============================================================================
void CDockWidget::raise()
{
if (isClosed())
{
return;
}
setAsCurrentTab();
if (isInFloatingContainer())
{
auto FloatingWindow = window();
FloatingWindow->raise();
FloatingWindow->activateWindow();
}
}
} // namespace ads
//---------------------------------------------------------------------------