Skip to content

Commit 047ea3c

Browse files
Implemented new dock overlay icons for sidebar areas
1 parent f71c8ff commit 047ea3c

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

src/DockOverlay.cpp

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
namespace ads
4949
{
5050
static const int AutoHideAreaWidth = 32;
51+
static const int AutoHideAreaMouseZone = 8;
5152

5253
/**
5354
* Private data class of CDockOverlay
@@ -73,6 +74,11 @@ struct DockOverlayPrivate
7374
* of the sidebar
7475
*/
7576
int sideBarOverlaySize(SideBarLocation sideBarLocation);
77+
78+
/**
79+
* The area where the mouse is considered in the sidebar
80+
*/
81+
int sideBarMouseZone(SideBarLocation sideBarLocation);
7682
};
7783

7884
/**
@@ -406,6 +412,22 @@ int DockOverlayPrivate::sideBarOverlaySize(SideBarLocation sideBarLocation)
406412
}
407413

408414

415+
//============================================================================
416+
int DockOverlayPrivate::sideBarMouseZone(SideBarLocation sideBarLocation)
417+
{
418+
auto Container = qobject_cast<CDockContainerWidget*>(TargetWidget.data());
419+
auto SideBar = Container->sideTabBar(sideBarLocation);
420+
if (!SideBar || !SideBar->isVisibleTo(Container))
421+
{
422+
return AutoHideAreaMouseZone;
423+
}
424+
else
425+
{
426+
return (SideBar->orientation() == Qt::Horizontal) ? SideBar->height() : SideBar->width();
427+
}
428+
}
429+
430+
409431
//============================================================================
410432
CDockOverlay::CDockOverlay(QWidget* parent, eMode Mode) :
411433
QFrame(parent),
@@ -469,28 +491,28 @@ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
469491
auto DockArea = qobject_cast<CDockAreaWidget*>(d->TargetWidget.data());
470492
if (!DockArea)
471493
{
472-
/*auto Rect = rect();
494+
auto Rect = rect();
473495
const QPoint pos = mapFromGlobal(QCursor::pos());
474-
if (pos.x() < d->sideBarOverlaySize(SideBarLeft))
496+
if (pos.x() < d->sideBarMouseZone(SideBarLeft))
475497
{
476498
return LeftAutoHideArea;
477499
}
478-
else if (pos.x() > (Rect.width() - d->sideBarOverlaySize(SideBarRight)))
500+
else if (pos.x() > (Rect.width() - d->sideBarMouseZone(SideBarRight)))
479501
{
480502
return RightAutoHideArea;
481503
}
482-
else if (pos.y() < d->sideBarOverlaySize(SideBarTop))
504+
else if (pos.y() < d->sideBarMouseZone(SideBarTop))
483505
{
484506
return TopAutoHideArea;
485507
}
486-
else if (pos.y() > (Rect.height() - d->sideBarOverlaySize(SideBarBottom)))
508+
else if (pos.y() > (Rect.height() - d->sideBarMouseZone(SideBarBottom)))
487509
{
488510
return BottomAutoHideArea;
489511
}
490512
else
491513
{
492514
return Result;
493-
}*/
515+
}
494516
return Result;
495517
}
496518

0 commit comments

Comments
 (0)