48
48
namespace ads
49
49
{
50
50
static const int AutoHideAreaWidth = 32 ;
51
+ static const int AutoHideAreaMouseZone = 8 ;
51
52
52
53
/* *
53
54
* Private data class of CDockOverlay
@@ -73,6 +74,11 @@ struct DockOverlayPrivate
73
74
* of the sidebar
74
75
*/
75
76
int sideBarOverlaySize (SideBarLocation sideBarLocation);
77
+
78
+ /* *
79
+ * The area where the mouse is considered in the sidebar
80
+ */
81
+ int sideBarMouseZone (SideBarLocation sideBarLocation);
76
82
};
77
83
78
84
/* *
@@ -406,6 +412,22 @@ int DockOverlayPrivate::sideBarOverlaySize(SideBarLocation sideBarLocation)
406
412
}
407
413
408
414
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
+
409
431
// ============================================================================
410
432
CDockOverlay::CDockOverlay (QWidget* parent, eMode Mode) :
411
433
QFrame (parent),
@@ -469,28 +491,28 @@ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
469
491
auto DockArea = qobject_cast<CDockAreaWidget*>(d->TargetWidget .data ());
470
492
if (!DockArea)
471
493
{
472
- /* auto Rect = rect();
494
+ auto Rect = rect ();
473
495
const QPoint pos = mapFromGlobal (QCursor::pos ());
474
- if (pos.x() < d->sideBarOverlaySize (SideBarLeft))
496
+ if (pos.x () < d->sideBarMouseZone (SideBarLeft))
475
497
{
476
498
return LeftAutoHideArea;
477
499
}
478
- else if (pos.x() > (Rect.width() - d->sideBarOverlaySize (SideBarRight)))
500
+ else if (pos.x () > (Rect.width () - d->sideBarMouseZone (SideBarRight)))
479
501
{
480
502
return RightAutoHideArea;
481
503
}
482
- else if (pos.y() < d->sideBarOverlaySize (SideBarTop))
504
+ else if (pos.y () < d->sideBarMouseZone (SideBarTop))
483
505
{
484
506
return TopAutoHideArea;
485
507
}
486
- else if (pos.y() > (Rect.height() - d->sideBarOverlaySize (SideBarBottom)))
508
+ else if (pos.y () > (Rect.height () - d->sideBarMouseZone (SideBarBottom)))
487
509
{
488
510
return BottomAutoHideArea;
489
511
}
490
512
else
491
513
{
492
514
return Result;
493
- }*/
515
+ }
494
516
return Result;
495
517
}
496
518
0 commit comments