Workspace 6.21.5
Public Member Functions | Protected Member Functions | List of all members
QtVariantProperty Class Reference

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

#include <Workspace/Widgets/PropertyBrowser/qtvariantproperty.h>

Inheritance diagram for QtVariantProperty:
[legend]

Public Member Functions

 ~QtVariantProperty ()
 
QVariant attributeValue (const QString &attribute) const
 
QMap< QString, QVariant > getAttributes ()
 
NamePathgetNamePath () const
 
const WidgetFactorygetWidgetFactory () const
 
int propertyType () const
 
void setAttribute (const QString &attribute, const QVariant &value)
 
void setAttributes (const QMap< QString, QVariant > &attributeMap)
 
void setNamePath (NamePath *namePath)
 
void setValue (const QVariant &value)
 
bool setWidgetFactory (const QString &widgetName)
 
void setWidgetFactory (const WidgetFactory *widgetFactory)
 
QVariant value () const
 
int valueType () const
 
- Public Member Functions inherited from QtProperty
virtual ~QtProperty ()
 
void addSubProperty (QtProperty *property)
 
QString displayText () const
 
QString getGlobalName () 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 setGlobalName (const QString &globalName)
 
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
 

Protected Member Functions

 QtVariantProperty (QtVariantPropertyManager *manager)
 
- Protected Member Functions inherited from QtProperty
 QtProperty (QtAbstractPropertyManager *manager)
 
void propertyChanged ()
 

Detailed Description

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:86
The QtVariantPropertyManager class provides and manages QVariant based properties.
Definition: qtvariantproperty.h:123
virtual void setValue(QtProperty *property, const QVariant &val)
Definition: qtvariantproperty.cpp:2109

you can write:

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

QtVariantProperty instances can only be created by the QtVariantPropertyManager class.

See also
QtProperty, QtVariantPropertyManager, QtVariantEditorFactory

Constructor & Destructor Documentation

◆ ~QtVariantProperty()

Destroys this property.

See also
QtProperty::~QtProperty()

◆ 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 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()}.

See also
setAttribute()

◆ getAttributes()

QMap< QString, QVariant > getAttributes ( )

Note: These attributes are used for Workspace widgets only.

See also
setAttributes

◆ getNamePath()

NamePath * getNamePath ( ) const

◆ getWidgetFactory()

const CSIRO::Widgets::WidgetFactory * getWidgetFactory ( ) const

◆ propertyType()

int propertyType ( ) const

Returns this property's type.

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

See also
valueType()

◆ setAttribute()

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

Sets the attribute of property to value.

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

See also
attributeValue()

◆ setAttributes()

void setAttributes ( const QMap< QString, QVariant > &  attributeMap)

Note: These attributes are used for Workspace widgets only.

See also
getAttributes

◆ setNamePath()

void setNamePath ( NamePath namePath)

Note: The property will delete the current NamePath when a new one is set.

◆ setValue()

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

◆ setWidgetFactory() [1/2]

bool setWidgetFactory ( const QString &  widgetName)
Returns
false when the widgetName is invalid or unsupported.

◆ setWidgetFactory() [2/2]

void setWidgetFactory ( const WidgetFactory widgetFactory)

◆ value()

QVariant value ( ) const

Returns the property's current value.

See also
valueType(), setValue()

◆ valueType()

int valueType ( ) const

Returns the type of this property's value.

See also
propertyType()