@@ -259,10 +259,6 @@ void DockAreaTitleBarPrivate::createTabBar()
259259 _this->connect (TabBar, SIGNAL (currentChanged (int )), SLOT (onCurrentTabChanged (int )));
260260 _this->connect (TabBar, SIGNAL (tabBarClicked (int )), SIGNAL (tabBarClicked (int )));
261261 _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&)));
266262}
267263
268264
@@ -519,25 +515,6 @@ void CDockAreaTitleBar::setVisible(bool Visible)
519515}
520516
521517
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-
541518// ============================================================================
542519void CDockAreaTitleBar::mousePressEvent (QMouseEvent* ev)
543520{
@@ -637,6 +614,26 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
637614}
638615
639616
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+
640637} // namespace ads
641638
642639#include " DockAreaTitleBar.moc"
0 commit comments