Skip to content

Commit b50e201

Browse files
Removed superfluous includes and fixed use of deprecates globalPositionOf() function
1 parent 7dee00f commit b50e201

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/AutoHideDockContainer.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
#include <QCursor>
3939

4040
#include "DockManager.h"
41-
#include "DockWidgetTab.h"
4241
#include "DockAreaWidget.h"
43-
#include "DockingStateReader.h"
4442
#include "ResizeHandle.h"
4543
#include "DockComponentsFactory.h"
4644
#include "AutoHideSideBar.h"
@@ -508,7 +506,8 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
508506
// ignore the event, because the auto hide overlay should not get collapsed if
509507
// user works in it
510508
QMouseEvent* me = static_cast<QMouseEvent*>(event);
511-
auto pos = mapFromGlobal(me->globalPos());
509+
auto GlobalPos = internal::globalPositionOf(me);
510+
auto pos = mapFromGlobal(GlobalPos);
512511
if (rect().contains(pos))
513512
{
514513
return Super::eventFilter(watched, event);
@@ -519,7 +518,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
519518
// do not ignore this here, then we will collapse the container and the side tab
520519
// click handler will uncollapse it
521520
auto SideTab = d->SideTab;
522-
pos = SideTab->mapFromGlobal(me->globalPos());
521+
pos = SideTab->mapFromGlobal(GlobalPos);
523522
if (SideTab->rect().contains(pos))
524523
{
525524
return Super::eventFilter(watched, event);
@@ -530,6 +529,16 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
530529
// should get collapsed
531530
collapseView(true);
532531
}
532+
else if (event->type() == QEvent::NonClientAreaMouseButtonPress)
533+
{
534+
// If the user starts dragging a floating widget, then we collapse
535+
// the auto hide widget
536+
CFloatingDockContainer* FloatingWidget = qobject_cast<CFloatingDockContainer*>(watched);
537+
if (FloatingWidget)
538+
{
539+
collapseView(true);
540+
}
541+
}
533542

534543
return Super::eventFilter(watched, event);
535544
}

0 commit comments

Comments
 (0)