From: sbh Date: Wed, 29 Oct 2014 12:25:23 +0000 (+0300) Subject: Issue #188 Bring back shortcuts X-Git-Tag: V_0.5~64^2~1^2~1^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e7205b28051a00406d00ff52d228f1a6dc38dc34;p=modules%2Fshaper.git Issue #188 Bring back shortcuts --- diff --git a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp index d6d6d6566..922ab9151 100644 --- a/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp +++ b/src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp index 5b2f24a14..21cef047d 100644 --- a/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp +++ b/src/ModuleBase/ModuleBase_WidgetPoint2D.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include diff --git a/src/XGUI/XGUI_Command.cpp b/src/XGUI/XGUI_Command.cpp index 4f726ab5d..1194dc454 100644 --- a/src/XGUI/XGUI_Command.cpp +++ b/src/XGUI/XGUI_Command.cpp @@ -49,6 +49,7 @@ QWidget* XGUI_Command::createWidget(QWidget* theParent) QString aToolTip = toolTip(); if (!aKeys.isEmpty()) { aToolTip = QString("%1 (%2)").arg(aToolTip).arg(aKeys.toString()); + aButton->setShortcut(aKeys); } if (!aToolTip.isEmpty()) { aButton->setToolTip(aToolTip); diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 33a411c0b..f93cb6b6a 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -13,8 +13,6 @@ XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent) : QObject(theParent) { - // listen to Escape signal to stop the current operation - qApp->installEventFilter(this); } XGUI_OperationMgr::~XGUI_OperationMgr() @@ -68,8 +66,8 @@ bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent) { if (theEvent->type() == QEvent::KeyRelease) { QKeyEvent* aKeyEvent = dynamic_cast(theEvent); - if(aKeyEvent && onKeyReleased(aKeyEvent)) { - return true; + if(aKeyEvent) { + return onKeyReleased(aKeyEvent); } } return QObject::eventFilter(theObject, theEvent); @@ -226,10 +224,6 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent) ModuleBase_Operation* anOperation = currentOperation(); bool isAccepted = true; switch (theEvent->key()) { - case Qt::Key_Escape: { - onAbortOperation(); - } - break; case Qt::Key_Return: case Qt::Key_Enter: { commitOperation(); diff --git a/src/XGUI/XGUI_PropertyPanel.cpp b/src/XGUI/XGUI_PropertyPanel.cpp index 9f6a706cf..94712d811 100644 --- a/src/XGUI/XGUI_PropertyPanel.cpp +++ b/src/XGUI/XGUI_PropertyPanel.cpp @@ -57,6 +57,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent) aBtn->setToolTip(tr("Cancel")); aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL); aBtn->setFlat(true); + aBtn->setShortcut(QKeySequence(Qt::Key_Escape)); aBtnLay->addWidget(aBtn); myCustomWidget = new QWidget(aContent); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index b9c0de9a1..22358aab9 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1008,6 +1008,7 @@ void XGUI_Workshop::createDockWidgets() hidePropertyPanel(); //tabifyDockWidget(aObjDock, myPropertyPanel); + myPropertyPanel->installEventFilter(myOperationMgr); QPushButton* aOkBtn = myPropertyPanel->findChild(XGUI::PROP_PANEL_OK); connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));