MIRA
Functions
mira::PropertyHints Namespace Reference

Namespace to put all PropertyHint creation functions. More...

Functions

template<typename T >
PropertyHint minimum (const T &min)
 Sets the attribute "minimum" to the specified value. More...
 
template<typename T >
PropertyHint maximum (const T &max)
 Sets the attribute "maximum" to the specified value. More...
 
template<typename T >
PropertyHint step (const T &step)
 Sets the attribute "step" to the specified value. More...
 
template<typename T >
PropertyHint limits (const T &min, const T &max)
 Sets both attributes "minimum" and "maximum" to the specified values. More...
 
PropertyHint precision (int p)
 Sets the attribute "precision". More...
 
PropertyHint type (const std::string &t)
 Sets the attribute "type" to the specified value. More...
 
PropertyHint enumeration (const std::string &values)
 Sets the attribute "enumeration". More...
 
template<typename T >
PropertyHint slider (const T &min, const T &max, const T &s)
 Sets the attribute "type" to the value "slider" and sets the "minimum", "maximum" and "step" attributes. More...
 
template<typename T >
PropertyHint spin (const T &min, const T &max, const T &s)
 Sets the attribute "type" to the value "spinbox" and sets the "minimum", "maximum" and "step" attributes. More...
 
PropertyHint file (const std::string &filters=std::string(), bool save=false)
 Tells the property editor that the path is for a file, and that it should show a "File Open"/"File Save" dialog instead of a "Choose Path" dialog. More...
 

Detailed Description

Namespace to put all PropertyHint creation functions.

Some common creation functions are defined in PropertyHint.h

Note
If you define new property hint creator functions, please make sure to make them inline to avoid performance penalties in serializers that are performance critical and that do NOT take care of these property hints (e.g. the binary serializers).

Function Documentation

◆ file()

PropertyHint mira::PropertyHints::file ( const std::string &  filters = std::string(),
bool  save = false 
)
inline

Tells the property editor that the path is for a file, and that it should show a "File Open"/"File Save" dialog instead of a "Choose Path" dialog.

Moreover you can optionally specify filters. Only files that match the given filter are shown. This filters parameter uses the same syntax as Qt's QFileDialog. Multiple filters can be separated by ";;", e.g.

"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"

The save parameter tells the property editor whether to use a "File Open" or a "File Save" dialog, i.e. whether to select an existing file or a location and name for a file to be created.