Scenario: start line creation, click 1st point, click 2nd point, click circle feature. The line become visible(to origin) in the previous version. Currently it is aborted, nothing is shown.
\r
public slots:\r
/// Called on call of command corresponded to a feature\r
- void onFeatureTriggered();\r
+ virtual void onFeatureTriggered();\r
\r
/// Slolt called on object display\r
/// \param theObject a data object\r
return true;
}
+void PartSet_Module::onFeatureTriggered()
+{
+ SessionPtr aMgr = ModelAPI_Session::get();
+ // 1. check whether the delete should be processed in the module
+ ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
+ bool isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
+ if (isNestedOp) {
+ // in case if in the viewer nothing is displayed, the create operation should not be
+ // comitted even if all values of the feature are initialized
+ if (!mySketchMgr->canDisplayCurrentCreatedFeature()) {
+ QAction* aCmd = dynamic_cast<QAction*>(sender());
+ //Do nothing on uncheck
+ if (aCmd->isCheckable() && !aCmd->isChecked())
+ return;
+
+ // the action information should be saved before the operation is aborted
+ // because this abort leads to update command status, which unchecks this action
+ anOperation->abort();
+
+ launchOperation(aCmd->data().toString());
+ }
+ }
+ ModuleBase_IModule::onFeatureTriggered();
+}
void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
{
/// Set a specific flag to restart the sketcher operation
void onNoMoreWidgets();
+ /// Redefines the parent method in order to customize the next case:
+ /// If the sketch nested operation is active and the presentation is not visualized in the viewer,
+ /// the operation should be always aborted.
+ virtual void onFeatureTriggered();
+
/// Slolt called on object display
/// \param theObject a data object
/// \param theAIS a presentation object
if (!anEditorWdg && !myIsPopupMenuActive) {
// during a nested create operation, the feature is redisplayed only if the mouse over view
// of there was a value modified in the property panel after the mouse left the view
- aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow;
+ aCanDisplay = canDisplayCurrentCreatedFeature();
}
}
#endif
return aCanDisplay;
}
+bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const
+{
+ return myIsPropertyPanelValueChanged || myIsMouseOverWindow;
+}
+
bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const
{
bool isFoundObject = false;
/// \param theObject a model object
bool canDisplayObject(const ObjectPtr& theObject) const;
+ /// Returns true if the mouse is over viewer or property panel value is changed
+ /// \return boolean result
+ bool canDisplayCurrentCreatedFeature() const;
+
/// Returns state of constraints showing flag
bool isConstraintsShown() const { return myIsConstraintsShown; }