summaryrefslogtreecommitdiff
path: root/src/libs/utils/fancymainwindow.cpp
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-07-15 12:47:15 +0200
committerhjk <hjk121@nokiamail.com>2014-07-18 08:14:56 +0200
commit3ed30f09cf779c5b50533f460b4ee522c9d0bf3f (patch)
treec4167dd5a8aeafb4846960711b234423e1c1000c /src/libs/utils/fancymainwindow.cpp
parent7eeaa6851fafa418b4264bc1ee1f6fd20ed6f991 (diff)
downloadqt-creator-3ed30f09cf779c5b50533f460b4ee522c9d0bf3f.tar.gz
{Fancy,Debugger}MainWindow: Consolidate dock actions menu population
There are several places where the list of dock actions are shown, and at least two where it was created. Change-Id: Ib2c18e602b5d6f57c1b7471bd75f3b989d536600 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/libs/utils/fancymainwindow.cpp')
-rw-r--r--src/libs/utils/fancymainwindow.cpp10
1 files changed, 4 insertions, 6 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