mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-03-16 02:59:51 +08:00
Ignore MouseButtonPress events of SideTabWidget in event filter
This commit is contained in:
parent
62d3d73651
commit
6c27115de8
@ -53,8 +53,6 @@ struct AutoHideDockContainerPrivate
|
|||||||
CDockWidget* DockWidget{nullptr};
|
CDockWidget* DockWidget{nullptr};
|
||||||
QPointer<CDockManager> DockManager{nullptr};
|
QPointer<CDockManager> DockManager{nullptr};
|
||||||
CDockWidgetSideTab::SideTabBarArea Area;
|
CDockWidgetSideTab::SideTabBarArea Area;
|
||||||
bool Collapsed = true;
|
|
||||||
bool Ignore = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private data constructor
|
* Private data constructor
|
||||||
@ -392,6 +390,8 @@ bool CAutoHideDockContainer::restoreState(CDockingStateReader& s, bool Testing)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
void CAutoHideDockContainer::toggleView(bool Enable)
|
void CAutoHideDockContainer::toggleView(bool Enable)
|
||||||
{
|
{
|
||||||
if (Enable)
|
if (Enable)
|
||||||
@ -414,21 +414,16 @@ void CAutoHideDockContainer::toggleView(bool Enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//============================================================================
|
||||||
void CAutoHideDockContainer::collapseView(bool Enable)
|
void CAutoHideDockContainer::collapseView(bool Enable)
|
||||||
{
|
{
|
||||||
std::cout << "COverlayDockContainer::collapseView " << Enable << " "
|
|
||||||
<< d->DockWidget->objectName().toStdString() << std::endl;
|
|
||||||
|
|
||||||
if (d->Ignore)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Enable)
|
if (Enable)
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
d->DockArea->hide();
|
d->DockArea->hide();
|
||||||
d->DockWidget->hide();
|
d->DockWidget->hide();
|
||||||
|
qApp->removeEventFilter(this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -438,7 +433,6 @@ void CAutoHideDockContainer::collapseView(bool Enable)
|
|||||||
d->DockWidget->show();
|
d->DockWidget->show();
|
||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
d->Collapsed = Enable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -515,20 +509,22 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
|||||||
return QSplitter::eventFilter(watched, event);
|
return QSplitter::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the mouse button down event is in the dock manager but outside
|
// Now check, if the user clicked into the side tab and ignore this event,
|
||||||
// of the open overlay container, then the overlay dock widget
|
// because the side tab click handler will call collapseView(). If we
|
||||||
// should get collapsed
|
// do not ignore this here, then we will collapse the container and the side tab
|
||||||
collapseView(true);
|
// click handler will uncollapse it
|
||||||
d->Ignore = true;
|
auto SideTab = d->DockWidget->sideTabWidget();
|
||||||
}
|
pos = SideTab->mapFromGlobal(me->globalPos());
|
||||||
else if (event->type() == QEvent::MouseButtonRelease)
|
if (SideTab->rect().contains(pos))
|
||||||
{
|
|
||||||
std::cout << "Mouse release: " << watched->metaObject()->className() << std::endl;
|
|
||||||
d->Ignore = false;
|
|
||||||
if (!isVisible())
|
|
||||||
{
|
{
|
||||||
qApp->removeEventFilter(this);
|
return QSplitter::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the mouse button down event is in the dock manager but outside
|
||||||
|
// of the open overlay container, then the auto hide dock widget
|
||||||
|
// should get collapsed
|
||||||
|
// If the user clicked into the side tab widget of this
|
||||||
|
collapseView(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return QSplitter::eventFilter(watched, event);
|
return QSplitter::eventFilter(watched, event);
|
||||||
|
Loading…
Reference in New Issue
Block a user