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 "DockManager.h"
#include "DockWidgetTab.h"
#include "DockAreaWidget.h"
#include "DockingStateReader.h"
#include "ResizeHandle.h"
#include "DockComponentsFactory.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
// user works in it
QMouseEvent* me = static_cast<QMouseEvent*>(event);
auto pos = mapFromGlobal(me->globalPos());
auto GlobalPos = internal::globalPositionOf(me);
auto pos = mapFromGlobal(GlobalPos);
if (rect().contains(pos))
{
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
// click handler will uncollapse it
auto SideTab = d->SideTab;
pos = SideTab->mapFromGlobal(me->globalPos());
pos = SideTab->mapFromGlobal(GlobalPos);
if (SideTab->rect().contains(pos))
{
return Super::eventFilter(watched, event);
@ -530,6 +529,16 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
// should get collapsed
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);
}