From a2842944364eb110dfb81b3252e34820cce8c628 Mon Sep 17 00:00:00 2001 From: sbh Date: Fri, 26 Sep 2014 13:32:41 +0400 Subject: [PATCH] Some "Enter processing" bugs fixed. --- src/PartSet/PartSet_OperationFeatureCreate.cpp | 1 + src/XGUI/XGUI_OperationMgr.cpp | 12 +++++++----- src/XGUI/XGUI_OperationMgr.h | 2 +- src/XGUI/XGUI_Workshop.cpp | 6 ------ 4 files changed, 9 insertions(+), 12 deletions(-) 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; -- 2.39.2