Improved hide / show functionality of dock widgets
This commit is contained in:
@@ -504,6 +504,18 @@ CDockWidget* CDockAreaWidget::currentDockWidget() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setCurrentDockWidget(CDockWidget* DockWidget)
|
||||
{
|
||||
int Index = tabIndex(DockWidget);
|
||||
if (Index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
setCurrentIndex(Index);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::setCurrentIndex(int index)
|
||||
{
|
||||
@@ -530,6 +542,7 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
||||
|
||||
if (i == index)
|
||||
{
|
||||
TitleWidget->show();
|
||||
TitleWidget->setActiveTab(true);
|
||||
d->TabsScrollArea->ensureWidgetVisible(TitleWidget);
|
||||
auto Features = TitleWidget->dockWidget()->features();
|
||||
@@ -542,6 +555,7 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
||||
}
|
||||
|
||||
d->ContentsLayout->setCurrentIndex(index);
|
||||
d->ContentsLayout->currentWidget()->show();
|
||||
emit currentChanged(index);
|
||||
}
|
||||
|
||||
@@ -585,6 +599,22 @@ QList<CDockWidget*> CDockAreaWidget::dockWidgets() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
QList<CDockWidget*> CDockAreaWidget::openDockWidgets() const
|
||||
{
|
||||
QList<CDockWidget*> DockWidgetList;
|
||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||
{
|
||||
CDockWidget* DockWidget = dockWidget(i);
|
||||
if (!DockWidget->isClosed())
|
||||
{
|
||||
DockWidgetList.append(dockWidget(i));
|
||||
}
|
||||
}
|
||||
return DockWidgetList;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
int CDockAreaWidget::indexOfContentByTitlePos(const QPoint& p, QWidget* exclude) const
|
||||
{
|
||||
@@ -665,6 +695,22 @@ void CDockAreaWidget::updateDockArea()
|
||||
d->updateTabBar();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::hideEvent(QHideEvent* event)
|
||||
{
|
||||
QFrame::hideEvent(event);
|
||||
emit visibilityChanged(isVisible());
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaWidget::showEvent(QShowEvent* event)
|
||||
{
|
||||
QFrame::showEvent(event);
|
||||
emit visibilityChanged(isVisible());
|
||||
}
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user