Salome HOME
Issue #188 Bring back shortcuts
authorsbh <sergey.belash@opencascade.com>
Wed, 29 Oct 2014 12:25:23 +0000 (15:25 +0300)
committersbh <sergey.belash@opencascade.com>
Wed, 29 Oct 2014 12:25:23 +0000 (15:25 +0300)
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/XGUI/XGUI_Command.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_Workshop.cpp

index d6d6d65664c8ab14edb97d487d63a621780fdf68..922ab91519dde70b29a459e79aa762472c752bff 100644 (file)
@@ -19,7 +19,6 @@
 #include <QLayout>
 #include <QLabel>
 #include <QEvent>
-#include <QKeyEvent>
 #include <QTimer>
 
 #include <math.h>
index 5b2f24a14c2c8de452d76cc21c6ebfef03f8d21b..21cef047dc80351fff5b0ca7a32d1aaa36d132b8 100644 (file)
@@ -23,7 +23,6 @@
 #include <QGridLayout>
 #include <QLabel>
 #include <QEvent>
-#include <QKeyEvent>
 
 #include <cfloat>
 #include <climits>
index 4f726ab5d442b62cc99675b5ffe0fc175ee138d4..1194dc4543785c84b0339555b385dab588506de9 100644 (file)
@@ -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);
index 33a411c0b37e71c5543947846c338dbaa24be69e..f93cb6b6a22a0b2f74a10be0d71596484de0ac36 100644 (file)
@@ -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<QKeyEvent*>(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();
index 9f6a706cfb418d9c8b7d368440be2e1d8b3cc487..94712d811a10ed6f52df4a2fb43c0a8586d70d40 100644 (file)
@@ -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);
index b9c0de9a1f3150856087cf3491eecbfba16d6ca6..22358aab96a01a69400684a6fc335bd2a2d5d9ed 100644 (file)
@@ -1008,6 +1008,7 @@ void XGUI_Workshop::createDockWidgets()
   hidePropertyPanel();  //<! Invisible by default
   hideObjectBrowser();
   aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
+  myPropertyPanel->installEventFilter(myOperationMgr);
 
   QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
   connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));