SHAPER  9.15.0
XGUI_Tools Namespace Reference

Commonly used methods in XGUI package and higher. More...

Functions

QString dir (const QString &path, bool isAbs=true)
 Return directory part of the file path. More...
 
QString file (const QString &path, bool withExt=true)
 Return file name part of the file path. More...
 
QString addSlash (const QString &path)
 Add a slash (platform-specific) to the end of path if it is not already there. More...
 
QString unionOfObjectNames (const QObjectPtrList &theObjects, const QString &theSeparator)
 
bool isModelObject (FeaturePtr theFeature)
 
std::string featureInfo (FeaturePtr theFeature)
 
bool canRemoveOrRename (QWidget *theParent, const std::set< FeaturePtr > &theFeatures)
 
bool isAscii (const QString &theStr)
 
bool isValidName (const QString &theName)
 
bool canRename (const ObjectPtr &theObject, const QString &theName)
 
XGUI_Workshopworkshop (ModuleBase_IWorkshop *theWorkshop)
 
QString generateName (const std::shared_ptr< ModuleBase_ViewerPrs > &thePrs)
 Generates a presentation name in form: <object_name>/<face>_<face_index> More...
 
std::wstring strToWStr (const std::string &theStr)
 
std::string getTmpDirByPath (const std::string &theTmpPath)
 
std::string getTmpDirByEnv (const char *thePathEnv)
 Creates and returns the temporary directory (with random name) using the environment variable path to location of such directories,. More...
 
void removeTemporaryFiles (const std::string &theDirectory, const std::list< std::string > &theFiles)
 Removes files and directory where they are located. More...
 

Detailed Description

Commonly used methods in XGUI package and higher.

Function Documentation

◆ dir()

QString XGUI_Tools::dir ( const QString &  path,
bool  isAbs = true 
)

Return directory part of the file path.

If the file path does not include directory part (the file is in the current directory), null string is returned.

Parameters
pathfile path
isAbsif true (default) path parameter is treated as absolute file path
Returns
directory part of the file path

◆ file()

QString XGUI_Tools::file ( const QString &  path,
bool  withExt = true 
)

Return file name part of the file path.

Parameters
pathfile path
withExtif true (default) complete file name (with all extension except the last) is returned, otherwise only base name is returned
Returns
file name part of the file path

◆ addSlash()

QString XGUI_Tools::addSlash ( const QString &  path)

Add a slash (platform-specific) to the end of path if it is not already there.

Parameters
pathdirectory path
Returns
modified path (with slash added to the end)

◆ unionOfObjectNames()

QString XGUI_Tools::unionOfObjectNames ( const QObjectPtrList &  theObjects,
const QString &  theSeparator 
)

Unite object names in one string using the separator between values

Parameters
theObjectsa list of objects
theSeparatora separator

◆ isModelObject()

bool XGUI_Tools::isModelObject ( FeaturePtr  theFeature)

Returns true if the feature is a model object

Parameters
theFeaturea feature

◆ featureInfo()

std::string XGUI_Tools::featureInfo ( FeaturePtr  theFeature)

Returns the string presentation of the given feature

Parameters
theFeaturea feature

◆ canRemoveOrRename()

bool XGUI_Tools::canRemoveOrRename ( QWidget theParent,
const std::set< FeaturePtr > &  theFeatures 
)

Returns true if there are no parts in the document, which are not activated or all objects in the list are not PartSet document. It shows the warning control if the result is false.

Parameters
theParenta parent for the warning control
theFeaturesa list of checked features
Returns
a boolean value

◆ isAscii()

bool XGUI_Tools::isAscii ( const QString &  theStr)

Checks that the given string contains only ASCII symbols

Parameters
theStra string to check

◆ canRename()

bool XGUI_Tools::canRename ( const ObjectPtr &  theObject,
const QString &  theName 
)

Check possibility to rename object

Parameters
theObjectan object to rename
theNamea name

◆ workshop()

XGUI_Workshop * XGUI_Tools::workshop ( ModuleBase_IWorkshop theWorkshop)

Returns converted workshop

Parameters
theWorkshopan interface workshop
Returns
XGUI workshop instance

◆ generateName()

QString XGUI_Tools::generateName ( const std::shared_ptr< ModuleBase_ViewerPrs > &  thePrs)

Generates a presentation name in form: <object_name>/<face>_<face_index>

Parameters
thePrsa presentation
Returns
string value

◆ getTmpDirByEnv()

std::string XGUI_Tools::getTmpDirByEnv ( const char *  thePathEnv)

Creates and returns the temporary directory (with random name) using the environment variable path to location of such directories,.

◆ removeTemporaryFiles()

void XGUI_Tools::removeTemporaryFiles ( const std::string &  theDirectory,
const std::list< std::string > &  theFiles 
)

Removes files and directory where they are located.