1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-04-16 10:24:45 +08:00

Removed superfluous includes and fixed use of deprecates globalPositionOf() function

This commit is contained in:
Uwe Kindler 2022-11-14 22:16:03 +01:00
parent 7dee00f89b
commit b50e2017e6

View File

@ -38,9 +38,7 @@
#include <QCursor> #include <QCursor>
#include "DockManager.h" #include "DockManager.h"
#include "DockWidgetTab.h"
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
#include "DockingStateReader.h"
#include "ResizeHandle.h" #include "ResizeHandle.h"
#include "DockComponentsFactory.h" #include "DockComponentsFactory.h"
#include "AutoHideSideBar.h" #include "AutoHideSideBar.h"
@ -508,7 +506,8 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
// ignore the event, because the auto hide overlay should not get collapsed if // ignore the event, because the auto hide overlay should not get collapsed if
// user works in it // user works in it
QMouseEvent* me = static_cast<QMouseEvent*>(event); QMouseEvent* me = static_cast<QMouseEvent*>(event);
auto pos = mapFromGlobal(me->globalPos()); auto GlobalPos = internal::globalPositionOf(me);
auto pos = mapFromGlobal(GlobalPos);
if (rect().contains(pos)) if (rect().contains(pos))
{ {
return Super::eventFilter(watched, event); return Super::eventFilter(watched, event);
@ -519,7 +518,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
// do not ignore this here, then we will collapse the container and the side tab // do not ignore this here, then we will collapse the container and the side tab
// click handler will uncollapse it // click handler will uncollapse it
auto SideTab = d->SideTab; auto SideTab = d->SideTab;
pos = SideTab->mapFromGlobal(me->globalPos()); pos = SideTab->mapFromGlobal(GlobalPos);
if (SideTab->rect().contains(pos)) if (SideTab->rect().contains(pos))
{ {
return Super::eventFilter(watched, event); return Super::eventFilter(watched, event);
@ -530,6 +529,16 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
// should get collapsed // should get collapsed
collapseView(true); collapseView(true);
} }
else if (event->type() == QEvent::NonClientAreaMouseButtonPress)
{
// If the user starts dragging a floating widget, then we collapse
// the auto hide widget
CFloatingDockContainer* FloatingWidget = qobject_cast<CFloatingDockContainer*>(watched);
if (FloatingWidget)
{
collapseView(true);
}
}
return Super::eventFilter(watched, event); return Super::eventFilter(watched, event);
} }