Manages the registration of specific object properties with the StelProperty system.
More...
#include <StelPropertyMgr.hpp>
A shortcut exists through StelModule::registerProperty. For more information on how to use this system, see the StelProperty class.
◆ getProperty()
StelProperty* StelPropertyMgr::getProperty |
( |
const QString & |
id, |
|
|
const bool |
noWarning = false |
|
) |
| const |
If not registered, a warning is written to logfile unless noWarning is true. This may be useful to suppress warnings about plugin module properties when these are not loaded, but should else be left true.
◆ getStelPropertyValue()
QVariant StelPropertyMgr::getStelPropertyValue |
( |
const QString & |
id, |
|
|
const bool |
noWarning = false |
|
) |
| const |
- Returns
- the current value of the StelProperty with the ID
id
, or an invalid QVariant when no property with the given ID is found. If not found, a warning is written to logfile unless noWarning is true. This may be useful to suppress warnings about plugin module properties when these are not loaded, but should else be left true.
◆ registerObject()
void StelPropertyMgr::registerObject |
( |
QObject * |
obj | ) |
|
The object must have an unique QObject::objectName, and this name should never change after registering. For all properties on this object, a StelProperty with an ID in the format <objectName>.<propertyName>
is generated.
◆ registerProperty()
StelProperty* StelPropertyMgr::registerProperty |
( |
const QString & |
id, |
|
|
QObject * |
target, |
|
|
const char * |
propertyName |
|
) |
| |
- Parameters
-
id | The identifier of the property. Must be unique, app will exit otherwise. It should follow the naming conventions as described in StelProperty. |
target | The QObject which contains the property. |
propertyName | The name of the Q_PROPERTY on the target which should be linked |
- Returns
- a new StelProperty linking to the property with name
propertyName
on the target
object
◆ setStelPropertyValue()
bool StelPropertyMgr::setStelPropertyValue |
( |
const QString & |
id, |
|
|
const QVariant & |
value |
|
) |
| const |
- Returns
true
when the value of the StelProperty with the ID id
has been successfully changed, and false
if the value change failed or when no property with the given ID is found.
◆ stelPropertyChanged
void StelPropertyMgr::stelPropertyChanged |
( |
StelProperty * |
prop, |
|
|
const QVariant & |
value |
|
) |
| |
|
signal |
- Parameters
-
prop | The property that was changed |
value | The new value of the property |