Added DockWidget functions setAsCurrentTab, raise, isCurrentTab, isTabbed
This commit is contained in:
@@ -55,8 +55,8 @@ class CDockingStateReader;
|
||||
* Container that manages a number of dock areas with single dock widgets
|
||||
* or tabyfied dock widgets in each area.
|
||||
* Each window that support docking has a DockContainerWidget. That means
|
||||
* the main application window and all floating windows are ore contain
|
||||
* an DockContainerWidget.
|
||||
* the main application window and all floating windows contain a
|
||||
* DockContainerWidget instance.
|
||||
*/
|
||||
class ADS_EXPORT CDockContainerWidget : public QFrame
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -455,6 +455,20 @@ public:
|
||||
*/
|
||||
bool isFullScreen() const;
|
||||
|
||||
/**
|
||||
* Returns true if this dock widget is in a dock area, that contains at
|
||||
* least 2 opened dock widgets
|
||||
*/
|
||||
bool isTabbed() const;
|
||||
|
||||
/**
|
||||
* Returns true if this dock widget is the current one in the dock
|
||||
* area widget that contains it.
|
||||
* If the dock widget is the only opened dock widget in a dock area,
|
||||
* the true is returned
|
||||
*/
|
||||
bool isCurrentTab() const;
|
||||
|
||||
public: // reimplements QFrame -----------------------------------------------
|
||||
/**
|
||||
* Emits titleChanged signal if title change event occurs
|
||||
@@ -468,6 +482,23 @@ public slots:
|
||||
*/
|
||||
void toggleView(bool Open = true);
|
||||
|
||||
/**
|
||||
* Makes this dock widget the current tab in its dock area.
|
||||
* The function only has an effect, if the dock widget is open. A call
|
||||
* to this function will not toggle the view, so if it is closed,
|
||||
* nothing will happen
|
||||
*/
|
||||
void setAsCurrentTab();
|
||||
|
||||
/**
|
||||
* Brings the dock widget to the front
|
||||
* This means:
|
||||
* - If the dock widget is tabbed with other dock widgets but its tab is not current, it's made current.
|
||||
* - If the dock widget is floating, QWindow::raise() is called.
|
||||
* This only applies if the dock widget is already open. If closed, does nothing.
|
||||
*/
|
||||
void raise();
|
||||
|
||||
/**
|
||||
* This function will make a docked widget floating
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user