Stellarium 0.15.2
List of all members | Public Types | Signals | Public Member Functions
StelPropertyMgr Class Reference

Manages the registration of specific object properties with the StelProperty system. More...

#include <StelPropertyMgr.hpp>

+ Inheritance diagram for StelPropertyMgr:
+ Collaboration diagram for StelPropertyMgr:

Public Types

typedef QMap< QString, StelProperty * > StelPropertyMap
 

Signals

void stelPropChanged (const QString &id, const QVariant &value)
 Emitted when any registered StelProperty has been changed. More...
 

Public Member Functions

 StelPropertyMgr ()
 Use StelApp::getStelPropertyManager to get the global instance. More...
 
StelPropertyregisterProperty (const QString &id, QObject *target, const char *propertyName)
 Manually register a new StelProperty. More...
 
void registerObject (QObject *obj)
 Registers all Q_PROPERTY definitions on this object as StelProperty. More...
 
QStringList getPropertyList () const
 Returns the keys of all registered StelProperties. More...
 
QList< StelProperty * > getAllProperties () const
 Returns all currently registered StelProperty instances. More...
 
const StelPropertyMap & getPropertyMap () const
 Returns a map from property IDs to StelProperty objects. More...
 
StelPropertygetProperty (const QString &id) const
 Returns the StelProperty with the specified ID, or NULL if not registered. More...
 
QVariant getStelPropertyValue (const QString &id) const
 Retrieves the current value of the given StelProperty, without requiring the retrieval of its object first. More...
 
bool setStelPropertyValue (const QString &id, const QVariant &value) const
 Sets the value of the given StelProperty, without requiring the retrieval of its object first. More...
 
QMetaProperty getMetaProperty (const QString &id) const
 Returns the QMetaProperty information for the given id. More...
 

Detailed Description

Manages the registration of specific object properties with the StelProperty system.

A shortcut exists through StelModule::registerProperty. For more information on how to use this system, see the StelProperty class.

Definition at line 257 of file StelPropertyMgr.hpp.

Constructor & Destructor Documentation

StelPropertyMgr::StelPropertyMgr ( )

Use StelApp::getStelPropertyManager to get the global instance.

Member Function Documentation

QList<StelProperty*> StelPropertyMgr::getAllProperties ( ) const

Returns all currently registered StelProperty instances.

QMetaProperty StelPropertyMgr::getMetaProperty ( const QString &  id) const

Returns the QMetaProperty information for the given id.

StelProperty* StelPropertyMgr::getProperty ( const QString &  id) const

Returns the StelProperty with the specified ID, or NULL if not registered.

QStringList StelPropertyMgr::getPropertyList ( ) const

Returns the keys of all registered StelProperties.

const StelPropertyMap& StelPropertyMgr::getPropertyMap ( ) const
inline

Returns a map from property IDs to StelProperty objects.

Definition at line 286 of file StelPropertyMgr.hpp.

QVariant StelPropertyMgr::getStelPropertyValue ( const QString &  id) const

Retrieves the current value of the given StelProperty, without requiring the retrieval of its object first.

Returns
the current value of the StelProperty with the ID id, or an invalid QVariant when no property with the given ID is found.
void StelPropertyMgr::registerObject ( QObject *  obj)

Registers all Q_PROPERTY definitions on this object as StelProperty.

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.

StelProperty* StelPropertyMgr::registerProperty ( const QString &  id,
QObject *  target,
const char *  propertyName 
)

Manually register a new StelProperty.

Parameters
idThe identifier of the property. Must be unique, app will exit otherwise. It should follow the naming conventions as described in StelProperty.
targetThe QObject which contains the property.
propertyNameThe 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
bool StelPropertyMgr::setStelPropertyValue ( const QString &  id,
const QVariant &  value 
) const

Sets the value of the given StelProperty, without requiring the retrieval of its object first.

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.
void StelPropertyMgr::stelPropChanged ( const QString &  id,
const QVariant &  value 
)
signal

Emitted when any registered StelProperty has been changed.

Parameters
idThe unique id of the property that was changed
valueThe new value of the property

The documentation for this class was generated from the following file: