#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_ResultParameter.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_Session.h>
#include <TopoDS_Iterator.hxx>
return aShapeType;
}
+void getParameters(QStringList& theParameters)
+{
+ theParameters.clear();
+
+ SessionPtr aSession = ModelAPI_Session::get();
+ std::list<DocumentPtr> aDocList;
+ DocumentPtr anActiveDocument = aSession->activeDocument();
+ DocumentPtr aRootDocument = aSession->moduleDocument();
+ aDocList.push_back(anActiveDocument);
+ if (anActiveDocument != aRootDocument) {
+ aDocList.push_back(aRootDocument);
+ }
+ std::string aGroupId = ModelAPI_ResultParameter::group();
+ for(std::list<DocumentPtr>::const_iterator it = aDocList.begin(); it != aDocList.end(); ++it) {
+ DocumentPtr aDocument = *it;
+ int aSize = aDocument->size(aGroupId);
+ for (int i = 0; i < aSize; i++) {
+ ObjectPtr anObject = aDocument->object(aGroupId, i);
+ std::string aParameterName = anObject->data()->name();
+ theParameters.append(aParameterName.c_str());
+ }
+ }
+}
+
} // namespace ModuleBase_Tools
const std::string& theDefault);
-// Returns the object from the attribute
+/// Returns the object from the attribute
/// \param theObj an object
MODULEBASE_EXPORT ObjectPtr getObject(const AttributePtr& theAttribute);
-// Returns the object from the attribute
+/// Returns the object from the attribute
/// \param theObj an object
MODULEBASE_EXPORT TopAbs_ShapeEnum getCompoundSubType(const TopoDS_Shape& theShape);
+/// Returns list of parameters accessible in the active part and partset
+/// \theParameters a list of parameter names
+MODULEBASE_EXPORT void getParameters(QStringList& theParameters);
+
}
#endif
{
}
+void ModuleBase_WidgetExprEditor::activateCustom()
+{
+ ModuleBase_ModelWidget::activateCustom();
+
+ QStringList aParameters;
+ ModuleBase_Tools::getParameters(aParameters);
+ myEditor->setCompletionList(aParameters);
+}
+
void ModuleBase_WidgetExprEditor::initializeValueByActivate()
{
}
const std::string& thePlaceHolder );
virtual ~ModuleBase_WidgetExprEditor();
+ /// The methiod called when widget is activated
+ virtual void activateCustom();
+
/// Redefinition of virtual method
virtual QList<QWidget*> getControls() const;