#include <cassert>
-GeomData_Point::GeomData_Point(TDF_Label& theLabel)
+GeomData_Point::GeomData_Point()
{
- myIsInitialized = true;
+ myIsInitialized = false;
}
void GeomData_Point::setCalculatedValue(const double theX, const double theY, const double theZ)
protected:
/// Initializes attributes
- GEOMDATA_EXPORT GeomData_Point(TDF_Label& theLabel);
+ GEOMDATA_EXPORT GeomData_Point();
friend class Model_Data;
};
#include <cassert>
-GeomData_Point2D::GeomData_Point2D(TDF_Label& theLabel)
+GeomData_Point2D::GeomData_Point2D()
{
- myIsInitialized = true;
+ myIsInitialized = false;
}
void GeomData_Point2D::setCalculatedValue(const double theX, const double theY)
protected:
/// Initializes attributes
- GEOMDATA_EXPORT GeomData_Point2D(TDF_Label& theLabel);
+ GEOMDATA_EXPORT GeomData_Point2D();
friend class Model_Data;
};
#include <ModelAPI_Expression.h>
#include <ModelAPI_Object.h>
-Model_AttributeDouble::Model_AttributeDouble(TDF_Label& theLabel)
+Model_AttributeDouble::Model_AttributeDouble()
{
- myIsInitialized = true;
+ myIsInitialized = false;
}
void Model_AttributeDouble::setCalculatedValue(const double theValue)
protected:
/// Initializes attributes
- Model_AttributeDouble(TDF_Label& theLabel);
+ Model_AttributeDouble();
friend class Model_Data;
};
#include <ModelAPI_Expression.h>
#include <ModelAPI_Object.h>
-Model_AttributeInteger::Model_AttributeInteger(TDF_Label& theLabel)
+Model_AttributeInteger::Model_AttributeInteger()
{
- myIsInitialized = true;
+ myIsInitialized = false;
}
void Model_AttributeInteger::setCalculatedValue(const int theValue)
protected:
/// Initializes attributes
- Model_AttributeInteger(TDF_Label& theLabel);
+ Model_AttributeInteger();
friend class Model_Data;
if (theAttrType == ModelAPI_AttributeDocRef::typeId()) {
anAttr = new Model_AttributeDocRef(anAttrLab);
} else if (theAttrType == Model_AttributeInteger::typeId()) {
- Model_AttributeInteger* anAttribute = new Model_AttributeInteger(anAttrLab);
+ Model_AttributeInteger* anAttribute = new Model_AttributeInteger();
// Expression should use the same label to support backward compatibility
TDF_Label anExpressionLab = anAttrLab;
anAttribute->myExpression.reset(new Model_ExpressionInteger(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression->isInitialized();
+ anAttribute->myIsInitialized = anAttribute->myExpression->isInitialized();
anAttr = anAttribute;
} else if (theAttrType == ModelAPI_AttributeDouble::typeId()) {
- Model_AttributeDouble* anAttribute = new Model_AttributeDouble(anAttrLab);
+ Model_AttributeDouble* anAttribute = new Model_AttributeDouble();
TDF_Label anExpressionLab = anAttrLab.FindChild(1);
anAttribute->myExpression.reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression->isInitialized();
+ anAttribute->myIsInitialized = anAttribute->myExpression->isInitialized();
anAttr = anAttribute;
} else if (theAttrType == Model_AttributeBoolean::typeId()) {
anAttr = new Model_AttributeBoolean(anAttrLab);
}
// create also GeomData attributes here because only here the OCAF structure is known
else if (theAttrType == GeomData_Point::typeId()) {
- GeomData_Point* anAttribute = new GeomData_Point(anAttrLab);
+ GeomData_Point* anAttribute = new GeomData_Point();
+ bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point::NUM_COMPONENTS; ++aComponent) {
TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1);
anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression[aComponent]->isInitialized();
+ anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized();
}
+ anAttribute->myIsInitialized = anAllInitialized;
anAttr = anAttribute;
} else if (theAttrType == GeomData_Dir::typeId()) {
anAttr = new GeomData_Dir(anAttrLab);
} else if (theAttrType == GeomData_Point2D::typeId()) {
- GeomData_Point2D* anAttribute = new GeomData_Point2D(anAttrLab);
+ GeomData_Point2D* anAttribute = new GeomData_Point2D();
+ bool anAllInitialized = true;
for (int aComponent = 0; aComponent < GeomData_Point2D::NUM_COMPONENTS; ++aComponent) {
TDF_Label anExpressionLab = anAttrLab.FindChild(aComponent + 1);
anAttribute->myExpression[aComponent].reset(new Model_ExpressionDouble(anExpressionLab));
- anAttribute->myIsInitialized = anAttribute->myIsInitialized && anAttribute->myExpression[aComponent]->isInitialized();
+ anAllInitialized = anAllInitialized && anAttribute->myExpression[aComponent]->isInitialized();
}
+ anAttribute->myIsInitialized = anAllInitialized;
anAttr = anAttribute;
}
if (anAttr) {
Model_Expression::Model_Expression(TDF_Label& theLabel)
{
- myIsInitialized = true;
if (!theLabel.FindAttribute(TDataStd_Name::GetID(), myText)) {
myText = TDataStd_Name::Set(theLabel, TCollection_ExtendedString());
-// myIsInitialized = false;
}
if (!theLabel.FindAttribute(TDataStd_Comment::GetID(), myError)) {
myError = TDataStd_Comment::Set(theLabel, TCollection_ExtendedString());
-// myIsInitialized = false;
}
if (!theLabel.FindAttribute(TDataStd_ExtStringList::GetID(), myUsedParameters)) {
myUsedParameters = TDataStd_ExtStringList::Set(theLabel);
-// myIsInitialized = false;
}
- // All this attributes should not set myIsInitialized = false.
- // This attributes are optional and may absent in old files. So this is OK.
- // The reason to set myIsInitialized = false is only absence of
- // the value attribute.
}
void Model_Expression::setText(const std::string& theValue)
}
}
}
- }
+ } else
+ myIsInitialized = true;
}
void Model_ExpressionDouble::setValue(const double theValue)
if (!theLabel.FindAttribute(TDataStd_Integer::GetID(), myInteger)) {
myInteger = TDataStd_Integer::Set(theLabel, 0);
myIsInitialized = false;
- }
+ } else
+ myIsInitialized = true;
}
void Model_ExpressionInteger::setValue(const int theValue)
#include <Events_Loop.h>
#include <ModelAPI_Events.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
// do not set a coincidence constraint in the attribute if the feature contains a point
// with the same coordinates. It is important for line creation in order to do not set
// the same constraints for the same points, oterwise the result line has zero length.
+ bool isAuxiliaryFeature = false;
if (getPoint2d(aView, aShape, aX, aY)) {
setPoint(aX, aY);
PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY);
if (MyFeaturesForCoincedence.contains(myFeature->getKind().c_str())) {
setConstraintWith(aObject);
setValueState(Stored); // in case of edge selection, Apply state should also be updated
+
+ FeaturePtr anObjectFeature = ModelAPI_Feature::feature(aObject);
+ std::string anAuxiliaryAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
+ AttributeBooleanPtr anAuxiliaryAttr = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
+ anObjectFeature->data()->attribute(anAuxiliaryAttribute));
+ if (anAuxiliaryAttr.get())
+ isAuxiliaryFeature = anAuxiliaryAttr->value();
}
}
// it is important to perform updateObject() in order to the current value is
// points of the line becomes less than the tolerance. Validator of the line returns
// false, the line will be aborted, but sketch stays valid.
updateObject(feature());
- if (!anOrphanPoint && !anExternal)
+ if (!anOrphanPoint && !anExternal && !isAuxiliaryFeature)
emit vertexSelected();
emit focusOutWidget(this);
}
} else {
switch (theId) {
case Accept:
- case AcceptAll:
+ case AcceptAll: {
aResult = new QAction(QIcon(":pictures/button_ok.png"), "", theParent);
- break;
+ aResult->setToolTip("Apply");
+ }
+ break;
case Abort:
case AbortAll: {
aResult = new QAction(QIcon(":pictures/button_cancel.png"), "", theParent);
- if(theId == Abort) {
+ aResult->setToolTip("Cancel");
+ if (theId == Abort) {
aResult->setShortcut(QKeySequence(Qt::Key_Escape));
}
}
break;
- case Help:
+ case Help: {
aResult = new QAction(QIcon(":pictures/button_help.png"), "", theParent);
- break;
+ aResult->setToolTip("Help");
+ }
+ break;
default:
break;
}
myErrorLabel(0),
myWorkshop(theWorkshop)
{
+ ModuleBase_ModelWidget* anActiveWidget = activeWidget();
+ XGUI_ActionsMgr* anActionsMgr = workshop()->actionsMgr();
+ QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
+ myAcceptAllToolTip = anAcceptAllAction->toolTip();
+ QAction* anOkAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::Accept);
+ myAcceptToolTip = anOkAction->toolTip();
}
XGUI_ErrorMgr::~XGUI_ErrorMgr()
QAction* anAcceptAllAction = anActionsMgr->operationStateAction(XGUI_ActionsMgr::AcceptAll, NULL);
bool anEnabled = anError.isEmpty();
anAcceptAllAction->setEnabled(anEnabled);
- anAcceptAllAction->setToolTip(anError);
+ anAcceptAllAction->setToolTip(!anEnabled ? anError : myAcceptAllToolTip);
}
}
bool anEnabled = theError.isEmpty();
theAction->setEnabled(anEnabled);
+ theAction->setToolTip(anEnabled ? myAcceptToolTip : theError);
// some operations have no property panel, so it is important to check that it is not null
if (myPropertyPanel) {
// update controls error information
ModuleBase_IWorkshop* myWorkshop; /// workshop
QDialog* myErrorDialog; /// contains the error message
QLabel* myErrorLabel; /// contains an error information
+ QString myAcceptToolTip; /// cached tool tip value for enabled Accept action
+ QString myAcceptAllToolTip; /// cached tool tip value for enabled AcceptAll action
};
#endif // XGUI_ErrorMgr_H
\ No newline at end of file