Computer Assisted Medical Intervention Tool Kit  version 5.2
QtVariantProperty Class Reference

The QtVariantProperty class is a convenience class handling QVariant based properties. More...

#include <qtvariantproperty.h>

+ Inheritance diagram for QtVariantProperty:
+ Collaboration diagram for QtVariantProperty:

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
 
QtAbstractPropertyManagerpropertyManager () 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
 

Detailed Description

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:

QtVariantPropertyManager *variantPropertyManager;
QtProperty *property;
variantPropertyManager->setValue(property, 10);
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:113
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition: qtvariantproperty.h:119
virtual void setValue(QtProperty *property, const QVariant &val)
Definition: qtvariantproperty.cpp:1654

you can write:

QtVariantPropertyManager *variantPropertyManager;
property->setValue(10);
The QtVariantProperty class is a convenience class handling QVariant based properties.
Definition: qtvariantproperty.h:97

QtVariantProperty instances can only be created by the QtVariantPropertyManager class.

See also
QtProperty, QtVariantPropertyManager, QtVariantEditorFactory

Constructor & Destructor Documentation

◆ ~QtVariantProperty()

QtVariantProperty::~QtVariantProperty ( )
override

Destroys this property.

See also
QtProperty::~QtProperty()

◆ QtVariantProperty()

QtVariantProperty::QtVariantProperty ( QtVariantPropertyManager manager)
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.

See also
QtVariantPropertyManager

Member Function Documentation

◆ attributeValue()

QVariant QtVariantProperty::attributeValue ( const QString &  attribute) const

Returns this property's value for the specified attribute.

QtVariantPropertyManager provides a couple of related functions: \l{QtVariantPropertyManager::attributes()}{attributes()} and \l{QtVariantPropertyManager::attributeType()}{attributeType()}.

See also
setAttribute()

References QtVariantPropertyManager::attributeValue(), and QtVariantPropertyPrivate::manager.

+ Here is the call graph for this function:

◆ propertyType()

int QtVariantProperty::propertyType ( ) const

Returns this property's type.

QtVariantPropertyManager provides several related functions: \l{QtVariantPropertyManager::enumTypeId()}{enumTypeId()}, \l{QtVariantPropertyManager::flagTypeId()}{flagTypeId()} and \l{QtVariantPropertyManager::groupTypeId()}{groupTypeId()}.

See also
valueType()

References QtVariantPropertyPrivate::manager, and QtVariantPropertyManager::propertyType().

+ Here is the call graph for this function:

◆ setAttribute() [1/2]

void QtVariantProperty::setAttribute ( const QString &  attribute,
const QMap< int, QIcon > &  value 
)
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 QtVariantPropertyPrivate::manager, QtVariantPropertyManager::setAttribute(), and value().

+ Here is the call graph for this function:

◆ setAttribute() [2/2]

void QtVariantProperty::setAttribute ( const QString &  attribute,
const QVariant &  value 
)

Sets the attribute of property to value.

QtVariantPropertyManager provides the related \l{QtVariantPropertyManager::setAttribute()}{setAttribute()} function.

See also
attributeValue()

References QtVariantPropertyPrivate::manager, QtVariantPropertyManager::setAttribute(), and value().

Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValue()

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.

See also
value()

References QtVariantPropertyPrivate::manager, QtVariantPropertyManager::setValue(), and value().

Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), main(), camitk::ObjectControllerPrivate::updateClassProperties(), ObjectControllerPrivate::updateClassProperties(), and camitk::ObjectControllerPrivate::updateDynamicProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value()

QVariant QtVariantProperty::value ( ) const

Returns the property's current value.

See also
valueType(), setValue()

References QtVariantPropertyPrivate::manager, and QtVariantPropertyManager::value().

Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), setAttribute(), and setValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valueType()

int QtVariantProperty::valueType ( ) const

Returns the type of this property's value.

See also
propertyType()

References QtVariantPropertyPrivate::manager, and QtVariantPropertyManager::valueType().

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ QtVariantPropertyManager

friend class QtVariantPropertyManager
friend

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