]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Some "Enter processing" bugs fixed.
authorsbh <sergey.belash@opencascade.com>
Fri, 26 Sep 2014 09:32:41 +0000 (13:32 +0400)
committersbh <sergey.belash@opencascade.com>
Fri, 26 Sep 2014 09:32:41 +0000 (13:32 +0400)
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_Workshop.cpp

index 2fd670acecfb825d9335cf9dd15d38ccac1a155e..1e7e3468b2796b014ee8412ce0650632b65c437b 100644 (file)
@@ -95,6 +95,7 @@ void PartSet_OperationFeatureCreate::keyReleased(const int theKey)
     case Qt::Key_Return:
     case Qt::Key_Enter: {
         // it start a new line creation at a free point
+      if(isValid())
         restartOperation(feature()->getKind());
     }
       break;
index 80b540a2443e5272a339af7125e1712e5747d1bb..04559839683a23f29219419d68b8b5a8652acabe 100644 (file)
@@ -68,8 +68,7 @@ bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent)
 {
   if (theEvent->type() == QEvent::KeyRelease) {
     QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
-    if(aKeyEvent) {
-      onKeyReleased(aKeyEvent);
+    if(aKeyEvent && onKeyReleased(aKeyEvent)) {
       return true;
     }
   }
@@ -217,11 +216,11 @@ void XGUI_OperationMgr::onOperationStopped()
   }
 }
 
-void XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
+bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
 {
   // Let the manager decide what to do with the given key combination.
   ModuleBase_Operation* anOperation = currentOperation();
-  bool isRestart = false;
+  bool isAccepted = true;
   switch (theEvent->key()) {
     case Qt::Key_Escape: {
       onAbortOperation();
@@ -236,10 +235,13 @@ void XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
     }
       break;
     default:
+      isAccepted = false;
       break;
   }
-  if(anOperation)
+  if(anOperation) {
     anOperation->keyReleased(theEvent->key());
+  }
+  return isAccepted;
 }
 
 void XGUI_OperationMgr::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
index 6307ce44d6373cdce138fbf2f966ff2aa86b06d4..ee8ff1f938643e9284d52e5e26c3aba0d87d8005 100644 (file)
@@ -106,7 +106,7 @@ signals:
   /// SLOT, that is called by the key in the property panel is clicked.
   /// \param theName the attribute name
   /// \param theEvent the mouse event
-  void onKeyReleased(QKeyEvent* theEvent);
+  bool onKeyReleased(QKeyEvent* theEvent);
 
   /// SLOT, that reacts to the widget activation
   /// \param theWidget an activated widget
index 899c2322766f83d562da8bb799aa65db6fc8f6eb..bce40c01f32782febc749882f3c1c122cdc3e1af 100644 (file)
@@ -527,12 +527,6 @@ bool XGUI_Workshop::event(QEvent * theEvent)
 {
   PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
   if (aPostponedEv) {
-#ifdef _DEBUG
-    std::cout << "XGUI_Workshop::event " << "Got PostponeMessageQtEvent" << std::endl;
-    bool isMyThread = (QApplication::instance()->thread() == QThread::currentThread());
-    std::cout << "XGUI_Workshop::event " << "I am in the Qt's thread: "
-              << isMyThread << std::endl;
-#endif
     boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
     processEvent(aEventPtr);
     return true;