summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/utils/fancymainwindow.cpp10
-rw-r--r--src/libs/utils/fancymainwindow.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp
index 44259411c7..62c3d91255 100644
--- a/src/libs/utils/fancymainwindow.cpp
+++ b/src/libs/utils/fancymainwindow.cpp
@@ -377,9 +377,9 @@ void FancyMainWindow::showEvent(QShowEvent *event)
void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event)
{
- QMenu *menu = createPopupMenu();
- menu->exec(event->globalPos());
- delete menu;
+ QMenu menu;
+ addDockActionsToMenu(&menu);
+ menu.exec(event->globalPos());
}
void FancyMainWindow::handleVisibilityChanged(bool visible)
@@ -448,7 +448,7 @@ static bool actionLessThan(const QAction *action1, const QAction *action2)
return action1->text().toLower() < action2->text().toLower();
}
-QMenu *FancyMainWindow::createPopupMenu()
+void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
{
QList<QAction *> actions;
QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
@@ -460,12 +460,10 @@ QMenu *FancyMainWindow::createPopupMenu()
}
}
qSort(actions.begin(), actions.end(), actionLessThan);
- QMenu *menu = new QMenu(this);
foreach (QAction *action, actions)
menu->addAction(action);
menu->addAction(&d->m_menuSeparator);
menu->addAction(&d->m_resetLayoutAction);
- return menu;
}
QAction *FancyMainWindow::menuSeparator() const
diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h
index 736e6ce9b5..8d2bb27e45 100644
--- a/src/libs/utils/fancymainwindow.h
+++ b/src/libs/utils/fancymainwindow.h
@@ -67,7 +67,7 @@ public:
QAction *resetLayoutAction() const;
// Overwritten to add locked/reset.
- virtual QMenu *createPopupMenu();
+ void addDockActionsToMenu(QMenu *menu);
QDockWidget *toolBarDockWidget() const;
void setToolBarDockWidget(QDockWidget *dock);