1. It shows a line edit control to visualize a feature name in the WidgetFeature.
if (!isInternalWidget(aWdgType)) {
aWidgetLay->addWidget(aWidget);
}
- else
+ else {
aWidget->setVisible(false);
+ }
}
if (myWidgetApi->isContainerWidget()) {
//if current widget is groupbox (container) process it's children recursively
#include <ModelAPI_AttributeRefAttr.h>
#include <QWidget>
+#include <QLineEdit>
+#include <QHBoxLayout>
+#include <QLabel>
ModuleBase_WidgetFeature::ModuleBase_WidgetFeature(QWidget* theParent,
const Config_WidgetAPI* theData)
{
QString aKinds = QString::fromStdString(theData->getProperty(FEATURE_KEYSEQUENCE));
myFeatureKinds = aKinds.split(" ");
+
+ myContainer = new QWidget(theParent);
+ QHBoxLayout* aControlLay = new QHBoxLayout(myContainer);
+ aControlLay->setContentsMargins(0, 0, 0, 0);
+
+ QString aLabelText = QString::fromStdString(theData->widgetLabel());
+ myLabel = new QLabel(aLabelText, myContainer);
+ aControlLay->addWidget(myLabel);
+
+ myEditor = new QLineEdit(myContainer);
+ QString anObjName = QString::fromStdString(attributeID());
+ myEditor->setObjectName(anObjName);
+ myEditor->setReadOnly(true);
+ aControlLay->addWidget(myEditor);
+
+ QString aTTip = QString::fromStdString(theData->widgetTooltip());
+ myEditor->setToolTip(aTTip);
+
+ aControlLay->addWidget(myEditor);
+ aControlLay->setStretch(1, 1);
}
ModuleBase_WidgetFeature::~ModuleBase_WidgetFeature()
if (!theFeature || !myFeatureKinds.contains(theFeature->getKind().c_str()))
return false;
- //bool isBlocked = this->blockSignals(true);
myFeature = theFeature;
- //this->blockSignals(isBlocked);
+ myEditor->setText(theFeature ? theFeature->data()->getName().c_str() : "");
emit valuesChanged();
return true;
}
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
ModuleBase_WidgetFeature* that = (ModuleBase_WidgetFeature*) this;
- //bool isBlocked = that->blockSignals(true);
aRef->setFeature(myFeature);
theFeature->execute();
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
- //that->blockSignals(isBlocked);
return true;
}
boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
- //bool isBlocked = this->blockSignals(true);
myFeature = aRef->feature();
- //this->blockSignals(isBlocked);
+ myEditor->setText(myFeature ? myFeature->data()->getName().c_str() : "");
return true;
}
QWidget* ModuleBase_WidgetFeature::getControl() const
{
- return 0;
+ return myContainer;
}
QList<QWidget*> ModuleBase_WidgetFeature::getControls() const
{
- QList<QWidget*> aControls;
- return aControls;
+ QList<QWidget*> aList;
+ aList.append(myLabel);
+ aList.append(myEditor);
+ return aList;
}
#include <QStringList>
class ModelAPI_Feature;
+class QWidget;
+class QLabel;
+class QLineEdit;
/**\class ModuleBase_WidgetFeature
* \ingroup GUI
private:
FeaturePtr myFeature; ///< the current widget feature
QStringList myFeatureKinds; ///< the kinds of possible features
+
+ QWidget* myContainer; /// the parent top control
+ QLabel* myLabel; /// the editor information label
+ QLineEdit* myEditor; ///< the feature editor to visualize the feature name
};
#endif
<feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
<feature id="SketchConstraintDistance" title="Distance between objects" tooltip="Create constraint for the distance from a point to an object">
<label title="Select point and another feature (point or point on line) between which to calculate distance" tooltip="Select point and another feature (point or point on line) between which to calculate distance"/>
- <feature_selector id="ConstraintEntityA" keysequence="SketchPoint" internal="1"/>
- <feature_selector id="ConstraintEntityB" keysequence="SketchPoint" internal="1"/>
+ <feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
+ <feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
<doublevalue_editor id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintLength" title="Length of a line" tooltip="Create constraint for the given length of a line segment">
<label title="Select a line entity on which to calculate lenght" tooltip="Select a line entity on which to calculate lenght"/>
- <feature_selector id="ConstraintEntityA" keysequence="SketchLine" internal="1"/>
+ <feature_selector id="ConstraintEntityA" label="Line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
<doublevalue_editor id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintRadius" title="Radius of a circle or an arc" tooltip="Create constraint for the given radius of a circle or an arc">
<label title="Select two points on a circle or an arc of circle on which to calculate radius" tooltip="Select two points on a circle or an arc of circle on which to calculate radius"/>
- <feature_selector id="ConstraintEntityA" keysequence="SketchCircle SketchArc" internal="1"/>
+ <feature_selector id="ConstraintEntityA" label="Circle or Arc" tooltip="Select an entity in the viewer" keysequence="SketchCircle SketchArc"/>
<point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
<doublevalue_editor id="ConstraintValue"/>
</feature>
<feature id="SketchConstraintParallel" title="Parallelism of a lines" tooltip="Create constraint defining two parallel lines">
- <feature_selector id="ConstraintEntityA" keysequence="SketchLine" internal="1"/>
- <feature_selector id="ConstraintEntityB" keysequence="SketchLine" internal="1"/>
+ <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
+ <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
</feature>
<feature id="SketchConstraintPerpendicular" title="Orthgonality of a lines" tooltip="Create constraint defining two perpendicular lines">
- <feature_selector id="ConstraintEntityA" keysequence="SketchLine" internal="1"/>
- <feature_selector id="ConstraintEntityB" keysequence="SketchLine" internal="1"/>
+ <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
+ <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an entity in the viewer" keysequence="SketchLine"/>
</feature>
</group>
</workbench>