Computer Assisted Medical Intervention Tool Kit  version 5.2
QtVariantPropertyManager Class Reference

The QtVariantPropertyManager class provides and manages QVariant based properties. More...

#include <qtvariantproperty.h>

+ Inheritance diagram for QtVariantPropertyManager:
+ Collaboration diagram for QtVariantPropertyManager:

Public Slots

virtual void setAttribute (QtProperty *property, const QString &attribute, const QMap< int, QIcon > &value)
 
virtual void setAttribute (QtProperty *property, const QString &attribute, const QVariant &value)
 
virtual void setValue (QtProperty *property, const QVariant &val)
 

Signals

void attributeChanged (QtProperty *property, const QString &attribute, const QVariant &val)
 
void valueChanged (QtProperty *property, const QVariant &val)
 
- Signals inherited from QtAbstractPropertyManager
void propertyChanged (QtProperty *property)
 
void propertyDestroyed (QtProperty *property)
 
void propertyInserted (QtProperty *property, QtProperty *parent, QtProperty *after)
 
void propertyRemoved (QtProperty *property, QtProperty *parent)
 

Public Member Functions

virtual QtVariantPropertyaddProperty (int propertyType, const QString &name=QString())
 
virtual QStringList attributes (int propertyType) const
 
virtual int attributeType (int propertyType, const QString &attribute) const
 
virtual QVariant attributeValue (const QtProperty *property, const QString &attribute) const
 
virtual bool isPropertyTypeSupported (int propertyType) const
 
int propertyType (const QtProperty *property) const
 
 QtVariantPropertyManager (QObject *parent=nullptr)
 
virtual QVariant value (const QtProperty *property) const
 
int valueType (const QtProperty *property) const
 
virtual int valueType (int propertyType) const
 
QtVariantPropertyvariantProperty (const QtProperty *property) const
 
 ~QtVariantPropertyManager () override
 
- Public Member Functions inherited from QtAbstractPropertyManager
QtPropertyaddProperty (const QString &name=QString())
 
void clear () const
 
QSet< QtProperty * > properties () const
 
 QtAbstractPropertyManager (QObject *parent=nullptr)
 
 ~QtAbstractPropertyManager () override
 

Static Public Member Functions

static int enumTypeId ()
 
static int flagTypeId ()
 
static int groupTypeId ()
 
static int iconMapTypeId ()
 

Protected Member Functions

QtPropertycreateProperty () override
 
bool hasValue (const QtProperty *property) const override
 
void initializeProperty (QtProperty *property) override
 
void uninitializeProperty (QtProperty *property) override
 
QIcon valueIcon (const QtProperty *property) const override
 
QString valueText (const QtProperty *property) const override
 
- Protected Member Functions inherited from QtAbstractPropertyManager
virtual QString displayText (const QtProperty *property) const
 
virtual EchoMode echoMode (const QtProperty *) const
 

Detailed Description

The QtVariantPropertyManager class provides and manages QVariant based properties.

QtVariantPropertyManager provides the addProperty() function which creates QtVariantProperty objects. The QtVariantProperty class is a convenience class handling QVariant based properties inheriting QtProperty. A QtProperty object created by a QtVariantPropertyManager instance can be converted into a QtVariantProperty object using the variantProperty() function.

The property's value can be retrieved using the value(), and set using the setValue() slot. In addition the property's type, and the type of its value, can be retrieved using the propertyType() and valueType() functions respectively.

A property's type is a QVariant::Type enumerator value, and usually a property's type is the same as its value type. But for some properties the types differ, for example for enums, flags and group types in which case QtVariantPropertyManager provides the enumTypeId(), flagTypeId() and groupTypeId() functions, respectively, to identify their property type (the value types are QVariant::Int for the enum and flag types, and QVariant::Invalid for the group type).

Use the isPropertyTypeSupported() function to check if a particular property type is supported. The currently supported property types are:

\table \header \o Property Type \o Property Type Id \row \o int \o QVariant::Int \row \o double \o QVariant::Double \row \o bool \o QVariant::Bool \row \o QString \o QVariant::String \row \o QDate \o QVariant::Date \row \o QTime \o QVariant::Time \row \o QDateTime \o QVariant::DateTime \row \o QKeySequence \o QVariant::KeySequence \row \o QChar \o QVariant::Char \row \o QLocale \o QVariant::Locale \row \o QPoint \o QVariant::Point \row \o QPointF \o QVariant::PointF \row \o QSize \o QVariant::Size \row \o QSizeF \o QVariant::SizeF \row \o QRect \o QVariant::Rect \row \o QRectF \o QVariant::RectF \row \o QVector3D \o QVariant::QVector3D \row \o QColor \o QVariant::Color \row \o QSizePolicy \o QVariant::SizePolicy \row \o QFont \o QVariant::Font \row \o QCursor \o QVariant::Cursor \row \o enum \o enumTypeId() \row \o flag \o flagTypeId() \row \o group \o groupTypeId() \endtable

Each property type can provide additional attributes, e.g. QVariant::Int and QVariant::Double provides minimum and maximum values. The currently supported attributes are:

\table \header \o Property Type \o Attribute Name \o Attribute Type \row \o int \o minimum \o QVariant::Int \row \o \o maximum \o QVariant::Int \row \o \o singleStep \o QVariant::Int \row \o double \o minimum \o QVariant::Double \row \o \o maximum \o QVariant::Double \row \o \o singleStep \o QVariant::Double \row \o \o decimals \o QVariant::Int \row \o QString \o regExp \o QVariant::RegExp \row \o QDate \o minimum \o QVariant::Date \row \o \o maximum \o QVariant::Date \row \o QPointF \o decimals \o QVariant::Int \row \o QSize \o minimum \o QVariant::Size \row \o \o maximum \o QVariant::Size \row \o QSizeF \o minimum \o QVariant::SizeF \row \o \o maximum \o QVariant::SizeF \row \o \o decimals \o QVariant::Int \row \o QRect \o constraint \o QVariant::Rect \row \o QRectF \o constraint \o QVariant::RectF \row \o \o decimals \o QVariant::Int \row \o enum \o enumNames \o QVariant::StringList \row \o \o enumIcons \o iconMapTypeId() \row \o flag \o flagNames \o QVariant::StringList \endtable

The attributes for a given property type can be retrieved using the attributes() function. Each attribute has a value type which can be retrieved using the attributeType() function, and a value accessible through the attributeValue() function. In addition, the value can be set using the setAttribute() slot.

QtVariantManager also provides the valueChanged() signal which is emitted whenever a property created by this manager change, and the attributeChanged() signal which is emitted whenever an attribute of such a property changes.

See also
QtVariantProperty, QtVariantEditorFactory

Constructor & Destructor Documentation

◆ QtVariantPropertyManager()

◆ ~QtVariantPropertyManager()

QtVariantPropertyManager::~QtVariantPropertyManager ( )
override

Destroys this manager, and all the properties it has created.

References QtAbstractPropertyManager::clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ addProperty()

QtVariantProperty * QtVariantPropertyManager::addProperty ( int  propertyType,
const QString &  name = QString() 
)
virtual

Creates and returns a variant property of the given propertyType with the given name.

If the specified propertyType is not supported by this variant manager, this function returns 0.

Do not use the inherited QtAbstractPropertyManager::addProperty() function to create a variant property (that function will always return 0 since it will not be clear what type the property should have).

See also
isPropertyTypeSupported()

References QtAbstractPropertyManager::addProperty(), isPropertyTypeSupported(), QtVariantPropertyManagerPrivate::m_creatingProperty, QtVariantPropertyManagerPrivate::m_propertyType, propertyType(), and variantProperty().

Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::addDynamicProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), QtVariantPropertyManagerPrivate::createSubProperty(), VariantManager::initializeProperty(), and main().

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

◆ attributeChanged

void QtVariantPropertyManager::attributeChanged ( QtProperty property,
const QString &  attribute,
const QVariant &  value 
)
signal

This signal is emitted whenever an attribute of a property created by this manager changes its value, passing a pointer to the property, the attribute and the new value as parameters.

See also
setAttribute()

Referenced by QtVariantPropertyManagerPrivate::slotConstraintChanged(), QtVariantPropertyManagerPrivate::slotDecimalsChanged(), QtVariantPropertyManagerPrivate::slotEchoModeChanged(), QtVariantPropertyManagerPrivate::slotEnumIconsChanged(), QtVariantPropertyManagerPrivate::slotEnumNamesChanged(), QtVariantPropertyManagerPrivate::slotFlagNamesChanged(), QtVariantPropertyManagerPrivate::slotRangeChanged(), QtVariantPropertyManagerPrivate::slotRegExpChanged(), and QtVariantPropertyManagerPrivate::slotSingleStepChanged().

+ Here is the caller graph for this function:

◆ attributes()

QStringList QtVariantPropertyManager::attributes ( int  propertyType) const
virtual

Returns a list of the given propertyType 's attributes.

See also
attributeValue(), attributeType()

References QtVariantPropertyManagerPrivate::m_typeToAttributeToAttributeType, and propertyType().

Referenced by attributeType(), and attributeValue().

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

◆ attributeType()

int QtVariantPropertyManager::attributeType ( int  propertyType,
const QString &  attribute 
) const
virtual

Returns the type of the specified attribute of the given propertyType.

If the given propertyType is not supported by this manager, or if the given propertyType does not possess the specified attribute, this function returns QVariant::Invalid.

See also
attributes(), valueType()

References attributes(), QtVariantPropertyManagerPrivate::m_typeToAttributeToAttributeType, and propertyType().

Referenced by setAttribute().

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

◆ attributeValue()

QVariant QtVariantPropertyManager::attributeValue ( const QtProperty property,
const QString &  attribute 
) const
virtual

Returns the given property's value for the specified attribute

If the given property was not created by this manager, or if the specified attribute does not exist, this function returns an invalid variant.

See also
attributes(), attributeType(), setAttribute()

References attributes(), QtVariantPropertyManagerPrivate::m_constraintAttribute, QtVariantPropertyManagerPrivate::m_decimalsAttribute, QtVariantPropertyManagerPrivate::m_echoModeAttribute, QtVariantPropertyManagerPrivate::m_enumIconsAttribute, QtVariantPropertyManagerPrivate::m_enumNamesAttribute, QtVariantPropertyManagerPrivate::m_flagNamesAttribute, QtVariantPropertyManagerPrivate::m_maximumAttribute, QtVariantPropertyManagerPrivate::m_minimumAttribute, QtVariantPropertyManagerPrivate::m_regExpAttribute, QtVariantPropertyManagerPrivate::m_singleStepAttribute, QtVariantPropertyManagerPrivate::m_typeToAttributeToAttributeType, QtProperty::propertyManager(), and propertyType().

Referenced by QtVariantProperty::attributeValue(), and setAttribute().

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

◆ createProperty()

QtProperty * QtVariantPropertyManager::createProperty ( )
overrideprotectedvirtual

◆ enumTypeId()

int QtVariantPropertyManager::enumTypeId ( )
static

Returns the type id for an enum property.

Note that the property's value type can be retrieved using the valueType() function (which is QVariant::Int for the enum property type).

See also
propertyType(), valueType()

Referenced by ObjectControllerPrivate::addClassProperties(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), QtVariantPropertyManagerPrivate::internalPropertyToType(), main(), QtVariantEditorFactory::QtVariantEditorFactory(), and QtVariantPropertyManager().

+ Here is the caller graph for this function:

◆ flagTypeId()

int QtVariantPropertyManager::flagTypeId ( )
static

Returns the type id for a flag property.

Note that the property's value type can be retrieved using the valueType() function (which is QVariant::Int for the flag property type).

See also
propertyType(), valueType()

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

+ Here is the caller graph for this function:

◆ groupTypeId()

int QtVariantPropertyManager::groupTypeId ( )
static

Returns the type id for a group property.

Note that the property's value type can be retrieved using the valueType() function (which is QVariant::Invalid for the group property type, since it doesn't provide any value).

See also
propertyType(), valueType()

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

+ Here is the caller graph for this function:

◆ hasValue()

bool QtVariantPropertyManager::hasValue ( const QtProperty property) const
overrideprotectedvirtual

\reimp

Reimplemented from QtAbstractPropertyManager.

References groupTypeId(), and propertyType().

+ Here is the call graph for this function:

◆ iconMapTypeId()

int QtVariantPropertyManager::iconMapTypeId ( )
static

Returns the type id for a icon map attribute.

Note that the property's attribute type can be retrieved using the attributeType() function.

See also
attributeType(), QtEnumPropertyManager::enumIcons()

Referenced by QtVariantPropertyManager().

+ Here is the caller graph for this function:

◆ initializeProperty()

void QtVariantPropertyManager::initializeProperty ( QtProperty property)
overrideprotectedvirtual

\reimp

Implements QtAbstractPropertyManager.

References QtAbstractPropertyManager::addProperty(), QtVariantPropertyManagerPrivate::createSubProperty(), QtVariantPropertyManagerPrivate::m_creatingSubProperties, QtVariantPropertyManagerPrivate::m_internalToProperty, QtVariantPropertyManagerPrivate::m_propertyType, QtVariantPropertyManagerPrivate::m_typeToPropertyManager, QtProperty::subProperties(), and variantProperty().

Referenced by VariantManager::initializeProperty().

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

◆ isPropertyTypeSupported()

bool QtVariantPropertyManager::isPropertyTypeSupported ( int  propertyType) const
virtual

Returns true if the given propertyType is supported by this variant manager; otherwise false.

See also
propertyType()

Reimplemented in VariantManager.

References QtVariantPropertyManagerPrivate::m_typeToValueType, and propertyType().

Referenced by ObjectControllerPrivate::addClassProperties(), addProperty(), camitk::ObjectControllerPrivate::buildQtVariantProperty(), VariantManager::isPropertyTypeSupported(), and camitk::ObjectControllerPrivate::updateDynamicProperties().

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

◆ propertyType()

int QtVariantPropertyManager::propertyType ( const QtProperty property) const

Returns the given property's type.

See also
valueType()

References QtVariantPropertyManagerPrivate::m_propertyToType.

Referenced by addProperty(), attributes(), attributeType(), attributeValue(), QtVariantEditorFactory::createEditor(), hasValue(), VariantManager::initializeProperty(), VariantManager::isPropertyTypeSupported(), isPropertyTypeSupported(), QtVariantProperty::propertyType(), setAttribute(), valueType(), and VariantManager::valueType().

+ Here is the caller graph for this function:

◆ setAttribute [1/2]

void QtVariantPropertyManager::setAttribute ( QtProperty property,
const QString &  attribute,
const QMap< int, QIcon > &  val 
)
virtualslot

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 QtVariantPropertyManagerPrivate::m_enumIconsAttribute, and QtProperty::propertyManager().

+ Here is the call graph for this function:

◆ setAttribute [2/2]

void QtVariantPropertyManager::setAttribute ( QtProperty property,
const QString &  attribute,
const QVariant &  val 
)
virtualslot

Sets the value of the specified attribute of the given property, to value.

The new value's type must be of the type returned by attributeType(), or of a type that can be converted to attributeType() using the QVariant::canConvert() function, otherwise this function does nothing.

See also
attributeValue(), QtVariantProperty::setAttribute(), attributeChanged()

References attributeType(), attributeValue(), QtVariantPropertyManagerPrivate::m_constraintAttribute, QtVariantPropertyManagerPrivate::m_decimalsAttribute, QtVariantPropertyManagerPrivate::m_echoModeAttribute, QtVariantPropertyManagerPrivate::m_enumIconsAttribute, QtVariantPropertyManagerPrivate::m_enumNamesAttribute, QtVariantPropertyManagerPrivate::m_flagNamesAttribute, QtVariantPropertyManagerPrivate::m_maximumAttribute, QtVariantPropertyManagerPrivate::m_minimumAttribute, QtVariantPropertyManagerPrivate::m_regExpAttribute, QtVariantPropertyManagerPrivate::m_singleStepAttribute, QtProperty::propertyManager(), and propertyType().

Referenced by QtVariantProperty::setAttribute().

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

◆ setValue

void QtVariantPropertyManager::setValue ( QtProperty property,
const QVariant &  value 
)
virtualslot

Sets the value of the given property to value.

The specified value must be of a type returned by valueType(), or of type that can be converted to valueType() using the QVariant::canConvert() function, otherwise this function does nothing.

See also
value(), QtVariantProperty::setValue(), valueChanged()

References QtProperty::propertyManager(), and valueType().

Referenced by QtVariantProperty::setValue(), and VariantManager::setValue().

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

◆ uninitializeProperty()

void QtVariantPropertyManager::uninitializeProperty ( QtProperty property)
overrideprotectedvirtual

\reimp

Reimplemented from QtAbstractPropertyManager.

References QtVariantPropertyManagerPrivate::m_destroyingSubProperties, QtVariantPropertyManagerPrivate::m_internalToProperty, and QtVariantPropertyManagerPrivate::m_propertyToType.

Referenced by VariantManager::uninitializeProperty().

+ Here is the caller graph for this function:

◆ value()

QVariant QtVariantPropertyManager::value ( const QtProperty property) const
virtual

Returns the given property's value.

If the given property is not managed by this manager, this function returns an invalid variant.

See also
setValue()

Reimplemented in VariantManager.

References QtProperty::propertyManager().

Referenced by QtVariantProperty::value(), and VariantManager::value().

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

◆ valueChanged

void QtVariantPropertyManager::valueChanged ( QtProperty property,
const QVariant &  value 
)
signal

This signal is emitted whenever a property created by this manager changes its value, passing a pointer to the property and the new value as parameters.

See also
setValue()

Referenced by QtVariantPropertyManager(), VariantManager::setValue(), QtVariantPropertyManagerPrivate::valueChanged(), and VariantManager::VariantManager().

+ Here is the caller graph for this function:

◆ valueIcon()

QIcon QtVariantPropertyManager::valueIcon ( const QtProperty property) const
overrideprotectedvirtual

\reimp

Reimplemented from QtAbstractPropertyManager.

References QtProperty::valueIcon().

+ Here is the call graph for this function:

◆ valueText()

QString QtVariantPropertyManager::valueText ( const QtProperty property) const
overrideprotectedvirtual

\reimp

Reimplemented from QtAbstractPropertyManager.

References QtProperty::displayText(), and QtProperty::valueText().

Referenced by VariantManager::valueText().

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

◆ valueType() [1/2]

int QtVariantPropertyManager::valueType ( const QtProperty property) const

Returns the given property's value type.

See also
propertyType()

References propertyType().

Referenced by setValue(), QtVariantProperty::valueType(), and VariantManager::valueType().

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

◆ valueType() [2/2]

int QtVariantPropertyManager::valueType ( int  propertyType) const
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns the value type associated with the given propertyType.

Reimplemented in VariantManager.

References QtVariantPropertyManagerPrivate::m_typeToValueType, and propertyType().

+ Here is the call graph for this function:

◆ variantProperty()

QtVariantProperty * QtVariantPropertyManager::variantProperty ( const QtProperty property) const

Returns the given property converted into a QtVariantProperty.

If the property was not created by this variant manager, the function returns 0.

See also
createProperty()

References QtVariantPropertyManagerPrivate::m_propertyToType.

Referenced by addProperty(), and initializeProperty().

+ Here is the caller graph for this function:

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