ui: Added singleton QtContextMenu with global back and forward actions

* QtContextMenu holds default actions for back and forward
* additional actions can be passed to extend the default menu
* currently used in QtMainWindow and QtCodeArea
* fixed crash on undo when only view actions happened since project load

bug id = 108
This commit is contained in:
Eberhard Graether
2016-06-30 16:49:16 +02:00
parent 32f894422d
commit 4e18389d38
9 changed files with 181 additions and 20 deletions
+2 -4
View File
@@ -21,6 +21,7 @@
#include "data/location/TokenLocationFile.h"
#include "qt/element/QtCodeFile.h"
#include "qt/element/QtCodeSnippet.h"
#include "qt/utility/QtContextMenu.h"
#include "qt/utility/QtHighlighter.h"
#include "settings/ApplicationSettings.h"
#include "settings/ColorScheme.h"
@@ -498,10 +499,7 @@ void QtCodeArea::contextMenuEvent(QContextMenuEvent* event)
if (m_setIDECursorPositionAction != nullptr)
{
m_eventPosition = event->pos();
QMenu menu(this);
menu.addAction(m_setIDECursorPositionAction);
menu.exec(event->globalPos());
QtContextMenu::getInstance()->showExtended(event, this, std::vector<QAction*>(1, m_setIDECursorPositionAction));
}
}