@@ -259,10 +259,6 @@ void DockAreaTitleBarPrivate::createTabBar()
259
259
_this->connect (TabBar, SIGNAL (currentChanged (int )), SLOT (onCurrentTabChanged (int )));
260
260
_this->connect (TabBar, SIGNAL (tabBarClicked (int )), SIGNAL (tabBarClicked (int )));
261
261
_this->connect (TabBar, SIGNAL (elidedChanged (bool )), SLOT (markTabsMenuOutdated ()));
262
-
263
- TabBar->setContextMenuPolicy (Qt::CustomContextMenu);
264
- _this->connect (TabBar, SIGNAL (customContextMenuRequested (const QPoint&)),
265
- SLOT (showContextMenu (const QPoint&)));
266
262
}
267
263
268
264
@@ -519,25 +515,6 @@ void CDockAreaTitleBar::setVisible(bool Visible)
519
515
}
520
516
521
517
522
- // ============================================================================
523
- void CDockAreaTitleBar::showContextMenu (const QPoint& pos)
524
- {
525
- if (d->DragState == DraggingFloatingWidget)
526
- {
527
- return ;
528
- }
529
-
530
- QMenu Menu (this );
531
- auto Action = Menu.addAction (tr (" Detach Area" ), this , SLOT (onUndockButtonClicked ()));
532
- Action->setEnabled (d->DockArea ->features ().testFlag (CDockWidget::DockWidgetFloatable));
533
- Menu.addSeparator ();
534
- Action = Menu.addAction (tr (" Close Area" ), this , SLOT (onCloseButtonClicked ()));
535
- Action->setEnabled (d->DockArea ->features ().testFlag (CDockWidget::DockWidgetClosable));
536
- Menu.addAction (tr (" Close Other Areas" ), d->DockArea , SLOT (closeOtherAreas ()));
537
- Menu.exec (mapToGlobal (pos));
538
- }
539
-
540
-
541
518
// ============================================================================
542
519
void CDockAreaTitleBar::mousePressEvent (QMouseEvent* ev)
543
520
{
@@ -637,6 +614,26 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
637
614
}
638
615
639
616
617
+ // ============================================================================
618
+ void CDockAreaTitleBar::contextMenuEvent (QContextMenuEvent* ev)
619
+ {
620
+ ev->accept ();
621
+ if (d->isDraggingState (DraggingFloatingWidget))
622
+ {
623
+ return ;
624
+ }
625
+
626
+ QMenu Menu (this );
627
+ auto Action = Menu.addAction (tr (" Detach Area" ), this , SLOT (onUndockButtonClicked ()));
628
+ Action->setEnabled (d->DockArea ->features ().testFlag (CDockWidget::DockWidgetFloatable));
629
+ Menu.addSeparator ();
630
+ Action = Menu.addAction (tr (" Close Area" ), this , SLOT (onCloseButtonClicked ()));
631
+ Action->setEnabled (d->DockArea ->features ().testFlag (CDockWidget::DockWidgetClosable));
632
+ Menu.addAction (tr (" Close Other Areas" ), d->DockArea , SLOT (closeOtherAreas ()));
633
+ Menu.exec (ev->globalPos ());
634
+ }
635
+
636
+
640
637
} // namespace ads
641
638
642
639
#include " DockAreaTitleBar.moc"
0 commit comments