@@ -392,16 +392,30 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
392
392
// End of tab moving, emit signal
393
393
if (d->DockArea )
394
394
{
395
+ ev->accept ();
395
396
Q_EMIT moved (internal::globalPositionOf (ev));
396
397
}
397
398
break ;
398
399
399
400
case DraggingFloatingWidget:
401
+ ev->accept ();
400
402
d->FloatingWidget ->finishDragging ();
401
403
break ;
402
404
403
405
default :; // do nothing
404
406
}
407
+ }
408
+ else if (ev->button () == Qt::MiddleButton)
409
+ {
410
+ if (CDockManager::testConfigFlag (CDockManager::MiddleMouseButtonClosesTab))
411
+ {
412
+ // Only attempt to close if the mouse is still
413
+ // on top of the widget, to allow the user to cancel.
414
+ if (rect ().contains (mapFromGlobal (QCursor::pos ()))) {
415
+ ev->accept ();
416
+ Q_EMIT closeRequested ();
417
+ }
418
+ }
405
419
}
406
420
407
421
Super::mouseReleaseEvent (ev);
@@ -628,14 +642,18 @@ QString CDockWidgetTab::text() const
628
642
// ============================================================================
629
643
void CDockWidgetTab::mouseDoubleClickEvent (QMouseEvent *event)
630
644
{
631
- // If this is the last dock area in a dock container it does not make
632
- // sense to move it to a new floating widget and leave this one
633
- // empty
634
- if ((!d->DockArea ->dockContainer ()->isFloating () || d->DockArea ->dockWidgetsCount () > 1 )
635
- && d->DockWidget ->features ().testFlag (CDockWidget::DockWidgetFloatable))
645
+ if (event->button () == Qt::LeftButton)
636
646
{
637
- d->saveDragStartMousePosition (internal::globalPositionOf (event));
638
- d->startFloating (DraggingInactive);
647
+ // If this is the last dock area in a dock container it does not make
648
+ // sense to move it to a new floating widget and leave this one
649
+ // empty
650
+ if ((!d->DockArea ->dockContainer ()->isFloating () || d->DockArea ->dockWidgetsCount () > 1 )
651
+ && d->DockWidget ->features ().testFlag (CDockWidget::DockWidgetFloatable))
652
+ {
653
+ event->accept ();
654
+ d->saveDragStartMousePosition (internal::globalPositionOf (event));
655
+ d->startFloating (DraggingInactive);
656
+ }
639
657
}
640
658
641
659
Super::mouseDoubleClickEvent (event);
0 commit comments