Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtVariantProperty Class Reference

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

#include <qtvariantproperty_p.h>

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

Public Member Functions

 ~QtVariantProperty ()
 Destroys this property.
 
QVariant value () const
 Returns the property's current value.
 
QVariant attributeValue (const QString &attribute) const
 Returns this property's value for the specified attribute.
 
int valueType () const
 Returns the type of this property's value.
 
int propertyType () const
 Returns this property's type.
 
void setValue (const QVariant &value)
 Sets the value of this property to value.
 
void setAttribute (const QString &attribute, const QVariant &value)
 Sets the attribute of property to value.
 
- Public Member Functions inherited from QtProperty
virtual ~QtProperty ()
 Destroys this property.
 
QList< QtProperty * > subProperties () const
 Returns the set of subproperties.
 
QtAbstractPropertyManagerpropertyManager () const
 Returns a pointer to the manager that owns this property.
 
QString toolTip () const
 
QString valueToolTip () const
 Returns the property value's tool tip.
 
QString descriptionToolTip () const
 Returns the property description's tool tip.
 
QString statusTip () const
 Returns the property's status tip.
 
QString whatsThis () const
 Returns the property's "What's This" help text.
 
QString propertyName () const
 Returns the property's name.
 
bool isEnabled () const
 Returns whether the property is enabled.
 
bool isModified () const
 Returns whether the property is modified.
 
bool hasValue () const
 Returns whether the property has a value.
 
QIcon valueIcon () const
 Returns an icon representing the current state of this property.
 
QString valueText () const
 Returns a string representing the current state of this property.
 
void setToolTip (const QString &text)
 
void setValueToolTip (const QString &text)
 Sets the property value's tool tip to the given text.
 
void setDescriptionToolTip (const QString &text)
 Sets the property description's tool tip to the given text.
 
void setStatusTip (const QString &text)
 Sets the property's status tip to the given text.
 
void setWhatsThis (const QString &text)
 Sets the property's "What's This" help text to the given text.
 
void setPropertyName (const QString &text)
 Sets the property's name to the given name.
 
void setEnabled (bool enable)
 Enables or disables the property according to the passed enable value.
 
void setModified (bool modified)
 Sets the property's modified state according to the passed modified value.
 
void addSubProperty (QtProperty *property)
 Appends the given property to this property's subproperties.
 
void insertSubProperty (QtProperty *property, QtProperty *afterProperty)
 Inserts the given property after the specified precedingProperty into this property's list of subproperties.
 
void removeSubProperty (QtProperty *property)
 Removes the given property from the list of subproperties without deleting it.
 

Protected Member Functions

 QtVariantProperty (QtVariantPropertyManager *manager)
 Creates a variant property using the given manager.
 
- Protected Member Functions inherited from QtProperty
 QtProperty (QtAbstractPropertyManager *manager)
 Creates a property with the given manager.
 
void propertyChanged ()
 

Friends

class QtVariantPropertyManager
 

Detailed Description

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

\inmodule QtDesigner

Since
4.4

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.

See also
QtProperty, QtVariantPropertyManager, QtVariantEditorFactory

Definition at line 28 of file qtvariantproperty_p.h.

Constructor & Destructor Documentation

◆ ~QtVariantProperty()

QtVariantProperty::~QtVariantProperty ( )

Destroys this property.

See also
QtProperty::~QtProperty()

Definition at line 168 of file qtvariantproperty.cpp.

◆ 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

Definition at line 158 of file qtvariantproperty.cpp.

References QtVariantProperty().

Referenced by QtVariantProperty(), and QtVariantPropertyManager::createProperty().

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

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

Definition at line 191 of file qtvariantproperty.cpp.

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

Definition at line 216 of file qtvariantproperty.cpp.

Referenced by qdesigner_internal::PropertyEditor::setObject().

+ Here is the caller graph for this function:

◆ setAttribute()

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

Definition at line 245 of file qtvariantproperty.cpp.

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

Definition at line 231 of file qtvariantproperty.cpp.

◆ value()

QVariant QtVariantProperty::value ( ) const

Returns the property's current value.

See also
valueType(), setValue()

Definition at line 177 of file qtvariantproperty.cpp.

◆ valueType()

int QtVariantProperty::valueType ( ) const

Returns the type of this property's value.

See also
propertyType()

Definition at line 201 of file qtvariantproperty.cpp.

Friends And Related Symbol Documentation

◆ QtVariantPropertyManager

friend class QtVariantPropertyManager
friend

Definition at line 42 of file qtvariantproperty_p.h.


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