Fixed some bugs in tabbar handling

This commit is contained in:
Uwe Kindler
2018-10-12 11:51:35 +02:00
parent ceebda7431
commit 9c95e34df5
4 changed files with 32 additions and 2 deletions

View File

@@ -265,6 +265,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
d->TabsLayout->insertWidget(Index, Tab);
connect(Tab, SIGNAL(clicked()), this, SLOT(onTabClicked()));
connect(Tab, SIGNAL(moved(const QPoint&)), this, SLOT(onTabWidgetMoved(const QPoint&)));
Tab->installEventFilter(this);
d->MenuOutdated = true;
if (Index <= d->CurrentIndex)
{
@@ -321,6 +322,7 @@ void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
d->TabsLayout->removeWidget(Tab);
Tab->disconnect(this);
Tab->removeEventFilter(this);
d->MenuOutdated = true;
qDebug() << "NewCurrentIndex " << NewCurrentIndex;
if (NewCurrentIndex != d->CurrentIndex)
@@ -448,6 +450,26 @@ void CDockAreaTabBar::closeTab(int Index)
}
emit tabCloseRequested(Index);
}
//===========================================================================
bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
{
bool Result = Super::eventFilter(watched, event);
if (event->type() != QEvent::Hide)
{
return Result;
}
CDockWidgetTab* Tab = qobject_cast<CDockWidgetTab*>(watched);
if (!Tab)
{
return Result;
}
qDebug() << "Hide event for tab " << Tab->text();
return Result;
}
} // namespace ads
//---------------------------------------------------------------------------