From d716617ae01c09ab616422ac98ef448f6a05751b Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 5 Jun 2022 00:25:48 +0200 Subject: [PATCH] FancyTabWidget: Make sure context menu does not popup outside of tabbar --- src/widgets/fancytabwidget.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widgets/fancytabwidget.cpp b/src/widgets/fancytabwidget.cpp index 91f48281d..68a90b4ed 100644 --- a/src/widgets/fancytabwidget.cpp +++ b/src/widgets/fancytabwidget.cpp @@ -716,6 +716,11 @@ void FancyTabWidget::addMenuItem(QActionGroup *group, const QString &text, Mode void FancyTabWidget::contextMenuEvent(QContextMenuEvent *e) { + if (!QRect(mapToGlobal(pos()), tabBar()->size()).contains(e->globalPos())) { + QTabWidget::contextMenuEvent(e); + return; + } + if (!menu_) { menu_ = new QMenu(this); QActionGroup *group = new QActionGroup(this);