@@ -486,6 +486,18 @@ void CAutoHideDockContainer::setSize(int Size)
486
486
updateSize ();
487
487
}
488
488
489
+ bool is_ancestor_of (const QObject *descendant, const QObject *ancestor)
490
+ {
491
+ if (!ancestor)
492
+ return false ;
493
+ while (descendant) {
494
+ if (descendant == ancestor)
495
+ return true ;
496
+ descendant = descendant->parent ();
497
+ }
498
+ return false ;
499
+ }
500
+
489
501
490
502
// ============================================================================
491
503
bool CAutoHideDockContainer::eventFilter (QObject* watched, QEvent* event)
@@ -503,17 +515,21 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
503
515
{
504
516
// If the user clicked into another window, then we collapse the
505
517
// auto hide widget
518
+ /* qDebug() << 1;
519
+ qDebug() << "is_ancestor_of " << is_ancestor_of(watched, this);
506
520
auto widget = qobject_cast<QWidget*>(watched);
521
+ qDebug() << "isAnchestorOf" << isAncestorOf(widget);
507
522
if (widget && widget->window() != this->window())
508
523
{
509
524
collapseView(true);
510
525
return Super::eventFilter(watched, event);
511
- }
526
+ }*/
512
527
513
528
// We check, if the mouse button press is inside the container
514
529
// widget. If it is not, i.e. if someone resizes the main window or
515
530
// clicks into the application menu or toolbar, then we ignore the
516
531
// event
532
+ qDebug () << 2 ;
517
533
auto Container = dockContainer ();
518
534
QMouseEvent* me = static_cast <QMouseEvent*>(event);
519
535
auto GlobalPos = internal::globalPositionOf (me);
@@ -527,6 +543,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
527
543
// If the click is inside of this auto hide container, then we can also
528
544
// ignore the event, because the auto hide overlay should not get collapsed if
529
545
// user works in it
546
+ qDebug () << 3 ;
530
547
pos = mapFromGlobal (GlobalPos);
531
548
if (rect ().contains (pos))
532
549
{
@@ -537,6 +554,7 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
537
554
// because the side tab click handler will call collapseView(). If we
538
555
// do not ignore this here, then we will collapse the container and the side tab
539
556
// click handler will uncollapse it
557
+ qDebug () << 4 ;
540
558
auto SideTab = d->SideTab ;
541
559
pos = SideTab->mapFromGlobal (GlobalPos);
542
560
if (SideTab->rect ().contains (pos))
@@ -547,9 +565,11 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
547
565
// If the mouse button down event is in the dock manager but outside
548
566
// of the open auto hide container, then the auto hide dock widget
549
567
// should get collapsed
568
+ qDebug () << 5 ;
550
569
collapseView (true );
551
570
}
552
- else if (event->type () == internal::FloatingWidgetDragStartEvent)
571
+ else if (event->type () == internal::FloatingWidgetDragStartEvent
572
+ || event->type () == internal::DockedWidgetDragStartEvent)
553
573
{
554
574
collapseView (true );
555
575
}
0 commit comments