From a80491419e4166beef2b3eb4c340aef6b1dd9414 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 7 Sep 2015 07:59:29 +0300 Subject: [PATCH] Result preview is low for the point. The updateViewer() should be blocked in moveObject() like it is done in updateObject() --- src/ModuleBase/ModuleBase_ModelWidget.cpp | 37 ++++++++++++++++------- src/ModuleBase/ModuleBase_ModelWidget.h | 4 +++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index c47c42ca6..556340b56 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -150,27 +150,22 @@ bool ModuleBase_ModelWidget::restoreValue() void ModuleBase_ModelWidget::updateObject(ObjectPtr theObj) { - // the viewer update should be blocked in order to avoid the temporary feature content - // when the solver processes the feature, the redisplay message can be flushed - // what caused the display in the viewer preliminary states of object - // e.g. fillet feature, angle value change - std::shared_ptr aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); - Events_Loop::loop()->send(aMsg); + blockUpdateViewer(true); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - // the viewer update should be unblocked - aMsg = std::shared_ptr( - new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); - Events_Loop::loop()->send(aMsg); + blockUpdateViewer(false); } void ModuleBase_ModelWidget::moveObject(ObjectPtr theObj) { + blockUpdateViewer(true); + static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED); ModelAPI_EventCreator::get()->sendUpdated(theObj, anEvent); Events_Loop::loop()->flush(anEvent); + + blockUpdateViewer(false); } bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent) @@ -196,3 +191,23 @@ void ModuleBase_ModelWidget::onWidgetValuesChanged() { storeValue(); } + +//************************************************************** +void ModuleBase_ModelWidget::blockUpdateViewer(const bool theValue) +{ + // the viewer update should be blocked in order to avoid the temporary feature content + // when the solver processes the feature, the redisplay message can be flushed + // what caused the display in the viewer preliminary states of object + // e.g. fillet feature, angle value change + std::shared_ptr aMsg; + if (theValue) { + aMsg = std::shared_ptr( + new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_BLOCKED))); + } + else { + // the viewer update should be unblocked + aMsg = std::shared_ptr( + new Events_Message(Events_Loop::eventByName(EVENT_UPDATE_VIEWER_UNBLOCKED))); + } + Events_Loop::loop()->send(aMsg); +} diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index bd9c15b0e..d09e824c1 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -204,6 +204,10 @@ protected: /// The method called when widget is activated virtual void activateCustom() {}; + /// Sends a message about block/unblock viewer updating + /// \param theValue a boolean value + static void blockUpdateViewer(const bool theValue); + protected slots: /// Processing of values changed in model widget by store the current value to the feature void onWidgetValuesChanged(); -- 2.39.2