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
+6 -2
View File
@@ -12,6 +12,7 @@
#include "component/view/View.h"
#include "component/view/CompositeView.h"
#include "qt/utility/QtContextMenu.h"
#include "qt/utility/utilityQt.h"
#include "qt/view/QtViewWidgetWrapper.h"
#include "qt/window/project_wizzard/QtProjectWizzard.h"
@@ -139,8 +140,6 @@ QtMainWindow::QtMainWindow()
setWindowIcon(QIcon((ResourcePaths::getGuiPath() + "icon/logo_1024_1024.png").c_str()));
setWindowFlags(Qt::Widget);
// QApplication::setOverrideCursor(Qt::ArrowCursor);
QApplication* app = dynamic_cast<QApplication*>(QCoreApplication::instance());
app->installEventFilter(new MouseReleaseFilter(this));
app->installEventFilter(new MouseWheelFilter(this));
@@ -314,6 +313,11 @@ void QtMainWindow::keyPressEvent(QKeyEvent* event)
}
}
void QtMainWindow::contextMenuEvent(QContextMenuEvent* event)
{
QtContextMenu::getInstance()->showDefault(event, this);
}
void QtMainWindow::activateWindow()
{
this->setEnabled(true);