From: sbh Date: Fri, 26 Sep 2014 09:32:41 +0000 (+0400) Subject: Some "Enter processing" bugs fixed. X-Git-Tag: V_0.4.4~9^2^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a2842944364eb110dfb81b3252e34820cce8c628;p=modules%2Fshaper.git Some "Enter processing" bugs fixed. --- diff --git a/src/PartSet/PartSet_OperationFeatureCreate.cpp b/src/PartSet/PartSet_OperationFeatureCreate.cpp index 2fd670ace..1e7e3468b 100644 --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@ -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; diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 80b540a24..045598396 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -68,8 +68,7 @@ bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent) { if (theEvent->type() == QEvent::KeyRelease) { QKeyEvent* aKeyEvent = dynamic_cast(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) diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h index 6307ce44d..ee8ff1f93 100644 --- a/src/XGUI/XGUI_OperationMgr.h +++ b/src/XGUI/XGUI_OperationMgr.h @@ -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 diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 899c23227..bce40c01f 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -527,12 +527,6 @@ bool XGUI_Workshop::event(QEvent * theEvent) { PostponeMessageQtEvent* aPostponedEv = dynamic_cast(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 aEventPtr = aPostponedEv->postponedMessage(); processEvent(aEventPtr); return true;