The QtVariantProperty class is a convenience class handling QVariant based properties. More...
#include <qtvariantproperty.h>
Public Member Functions | |
| QVariant | attributeValue (const QString &attribute) const |
| int | propertyType () const |
| virtual void | setAttribute (const QString &attribute, const QMap< int, QIcon > &value) |
| void | setAttribute (const QString &attribute, const QVariant &value) |
| void | setValue (const QVariant &value) |
| QVariant | value () const |
| int | valueType () const |
| ~QtVariantProperty () override | |
| Public Member Functions inherited from QtProperty | |
| void | addSubProperty (QtProperty *property) |
| QString | displayText () const |
| bool | hasValue () const |
| void | insertSubProperty (QtProperty *property, QtProperty *afterProperty) |
| bool | isEnabled () const |
| bool | isModified () const |
| QtAbstractPropertyManager * | propertyManager () const |
| QString | propertyName () const |
| void | removeSubProperty (QtProperty *property) |
| void | setEnabled (bool enable) |
| void | setModified (bool modified) |
| void | setPropertyName (const QString &text) |
| void | setStatusTip (const QString &text) |
| void | setToolTip (const QString &text) |
| void | setWhatsThis (const QString &text) |
| QString | statusTip () const |
| QList< QtProperty * > | subProperties () const |
| QString | toolTip () const |
| QIcon | valueIcon () const |
| QString | valueText () const |
| QString | whatsThis () const |
| virtual | ~QtProperty () |
Protected Member Functions | |
| QtVariantProperty (QtVariantPropertyManager *manager) | |
| Protected Member Functions inherited from QtProperty | |
| void | propertyChanged () |
| QtProperty (QtAbstractPropertyManager *manager) | |
Friends | |
| class | QtVariantPropertyManager |
The QtVariantProperty class is a convenience class handling QVariant based properties.
QtVariantProperty provides additional API: A property's type, value type, attribute values and current value can easily be retrieved using the propertyType(), valueType(), attributeValue() and value() functions respectively. In addition, the attribute values and the current value can be set using the corresponding setValue() and setAttribute() functions.
For example, instead of writing:
you can write:
QtVariantProperty instances can only be created by the QtVariantPropertyManager class.
|
override |
Destroys this property.
|
protected |
Creates a variant property using the given manager.
Do not use this constructor to create variant property instances; use the QtVariantPropertyManager::addProperty() function instead. This constructor is used internally by the QtVariantPropertyManager::createProperty() function.
References QtProperty::QtProperty(), and QtVariantPropertyManager.
| QVariant QtVariantProperty::attributeValue | ( | const QString & | attribute | ) | const |
Returns this property's value for the specified attribute.
QtVariantPropertyManager provides a couple of related functions: QtVariantPropertyManager::attributes(){attributes()} and QtVariantPropertyManager::attributeType(){attributeType()}.
| int QtVariantProperty::propertyType | ( | ) | const |
Returns this property's type.
QtVariantPropertyManager provides several related functions: QtVariantPropertyManager::enumTypeId(){enumTypeId()}, QtVariantPropertyManager::flagTypeId(){flagTypeId()} and QtVariantPropertyManager::groupTypeId(){groupTypeId()}.
|
virtual |
Added in CamiTK. In order to manage setting the icons list, the QtEnumPropertyManager needs a QMap<int,QIcon> But QMap<int,QIcon> cannot be transformed to QVariant, therefore this method had to be added.
References value().
| void QtVariantProperty::setAttribute | ( | const QString & | attribute, |
| const QVariant & | value ) |
Sets the attribute of property to value.
QtVariantPropertyManager provides the related QtVariantPropertyManager::setAttribute(){setAttribute()} function.
References value().
Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), and main().
| void QtVariantProperty::setValue | ( | const QVariant & | value | ) |
Sets the value of this property to value.
The specified value must be of the type returned by valueType(), or of a type that can be converted to valueType() using the QVariant::canConvert() function; otherwise this function does nothing.
References value().
Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), main(), VariantManager::setValue(), camitk::ObjectControllerPrivate::updateClassProperties(), ObjectControllerPrivate::updateClassProperties(), and camitk::ObjectControllerPrivate::updateDynamicProperties().
| QVariant QtVariantProperty::value | ( | ) | const |
Returns the property's current value.
Referenced by setAttribute(), setAttribute(), setValue(), and QtVariantPropertyManager::variantProperty().
| int QtVariantProperty::valueType | ( | ) | const |
Returns the type of this property's value.
|
friend |
References QtVariantPropertyManager.
Referenced by QtVariantProperty(), and QtVariantPropertyManager.