20 #ifndef ModuleBase_Tools_H
21 #define ModuleBase_Tools_H
23 #include "ModuleBase.h"
24 #include "ModuleBase_Definitions.h"
26 #include <ModelAPI_Attribute.h>
27 #include <ModelAPI_Feature.h>
28 #include <ModelAPI_Folder.h>
30 #include <TopAbs_ShapeEnum.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <Prs3d_Drawer.hxx>
33 #include <AIS_Shape.hxx>
35 #include <Quantity_Color.hxx>
56 namespace ModuleBase_Tools {
59 MODULEBASE_EXPORT
void adjustMargins(
QWidget* theWidget);
60 MODULEBASE_EXPORT
void adjustMargins(QLayout* theLayout);
62 MODULEBASE_EXPORT
void zeroMargins(
QWidget* theWidget);
63 MODULEBASE_EXPORT
void zeroMargins(QLayout* theLayout);
70 MODULEBASE_EXPORT
void activateWindow(
QWidget* theWidget,
const QString& theInfo = QString());
77 MODULEBASE_EXPORT
void setFocus(
QWidget* theWidget,
const QString& theInfo = QString());
84 MODULEBASE_EXPORT
void setShadowEffect(
QWidget* theWidget,
const bool isSetEffect);
96 MODULEBASE_EXPORT QPixmap
composite(
const QString& theAdditionalIcon,
const QString& theIcon);
105 MODULEBASE_EXPORT QPixmap
composite(
const QImage& theAdditionalIcon, QImage& theIcon);
117 MODULEBASE_EXPORT QPixmap lighter(
const QString& theIcon,
const int theLighterValue = 200);
122 MODULEBASE_EXPORT
void setSpinValue(
QDoubleSpinBox* theSpin,
double theValue);
152 MODULEBASE_EXPORT QAction* createAction(
const QIcon& theIcon,
const QString& theText,
154 const char* theMember =
"",
155 const QString& theToolTip = QString(),
156 const QString& theStatusTip = QString());
162 MODULEBASE_EXPORT QString objectName(
const ObjectPtr& theObj);
168 MODULEBASE_EXPORT QString objectInfo(
const ObjectPtr& theObj,
169 const bool isUseAttributesInfo =
false);
175 MODULEBASE_EXPORT
int shapeType(
const QString& theType);
180 MODULEBASE_EXPORT
bool isSubResult(ObjectPtr theObject);
190 MODULEBASE_EXPORT
void checkObjects(
const QObjectPtrList& theObjects,
bool& hasResult,
191 bool& hasFeature,
bool& hasParameter,
bool& hasCompositeOwner,
192 bool& hasResultInHistory,
bool& hasFolder,
bool &hasGroupsOnly);
206 MODULEBASE_EXPORT
void setDefaultDeviationCoefficient(
const TopoDS_Shape& theShape,
207 const Handle(Prs3d_Drawer)& theDrawer);
213 MODULEBASE_EXPORT Quantity_Color color(
const std::string& theSection,
214 const std::string& theName);
218 MODULEBASE_EXPORT ObjectPtr getObject(
const AttributePtr& theAttribute);
222 MODULEBASE_EXPORT TopAbs_ShapeEnum getCompoundSubType(
const TopoDS_Shape& theShape);
227 MODULEBASE_EXPORT TopoDS_Shape getSelectedShape(
228 const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
232 MODULEBASE_EXPORT
void getParameters(QStringList& theParameters);
237 const FeaturePtr& theFeature);
247 MODULEBASE_EXPORT
bool hasObject(
const AttributePtr& theAttribute,
const ObjectPtr& theObject,
248 const std::shared_ptr<GeomAPI_Shape>& theShape,
250 const bool theTemporarily);
262 MODULEBASE_EXPORT
bool setObject(
const AttributePtr& theAttribute,
const ObjectPtr& theObject,
263 const std::shared_ptr<GeomAPI_Shape>& theShape,
265 const bool theTemporarily,
266 const bool theCheckIfAttributeHasObject);
272 MODULEBASE_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(
const AttributePtr& theAttribute,
277 MODULEBASE_EXPORT
void flushUpdated(ObjectPtr theObject);
281 MODULEBASE_EXPORT
void blockUpdateViewer(
const bool theValue);
287 MODULEBASE_EXPORT QString wrapTextByWords(
const QString& theValue,
QWidget* theWidget,
288 int theMaxLineInPixels = 150);
293 MODULEBASE_EXPORT QLocale doubleLocale();
298 void MODULEBASE_EXPORT refsToFeatureInFeatureDocument(
const ObjectPtr& theObject,
299 std::set<FeaturePtr>& theRefFeatures);
321 std::shared_ptr<ModelAPI_Result> MODULEBASE_EXPORT firstResult(
const ObjectPtr& theObject);
327 bool MODULEBASE_EXPORT hasModuleDocumentFeature(
const std::set<FeaturePtr>& theFeatures);
335 bool MODULEBASE_EXPORT askToDelete(
const std::set<FeaturePtr> aFeatures,
336 const std::map<FeaturePtr,
337 std::set<FeaturePtr> >& theReferences,
339 std::set<FeaturePtr>& theReferencesToDelete,
340 const std::string& thePrefixInfo =
"");
345 bool MODULEBASE_EXPORT warningAboutConflict(
QWidget* theParent,
const std::string& theWarningText);
352 void MODULEBASE_EXPORT convertToFeatures(
const QObjectPtrList& theObjects,
353 std::set<FeaturePtr>& theFeatures);
359 void MODULEBASE_EXPORT convertToFolders(
const QObjectPtrList& theObjects,
360 std::set<FolderPtr>& theFolders);
374 QString MODULEBASE_EXPORT translate(
const std::string& theContext,
const std::string& theMessage);
382 FeaturePtr MODULEBASE_EXPORT createParameter(
const QString& theText);
387 void MODULEBASE_EXPORT editParameter(FeaturePtr theParam,
const QString& theText);
391 bool MODULEBASE_EXPORT isNameExist(
const QString& theName, FeaturePtr theIgnoreParameter);
395 FeaturePtr MODULEBASE_EXPORT findParameter(
const QString& theName);
402 bool MODULEBASE_EXPORT isSameShape(
const TopoDS_Shape& theShape1,
const TopoDS_Shape& theShape2);
409 std::wstring MODULEBASE_EXPORT generateName(
const AttributePtr& theAttribute,
413 qreal MODULEBASE_EXPORT currentPixelRatio();
417 void MODULEBASE_EXPORT setDisplaying(std::shared_ptr<ModelAPI_ResultPart> thePart,
418 bool theDisplayFromScript =
false);
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
An extension of a double spin box which let to use parameters and expressions for value definition.
Definition: ModuleBase_ParamIntSpinBox.h:34
An extension of a double spin box which let to use parameters and expressions for value definition.
Definition: ModuleBase_ParamSpinBox.h:37
Presentation.
Definition: ModuleBase_ViewerPrs.h:37
QPixmap composite(const QString &theAdditionalIcon, const QString &theIcon)
Methods to modify a resource pixmap.
Definition: ModuleBase_Tools.cpp:244