The QtEnumPropertyManager provides and manages enum properties. More...
#include <qtpropertymanager.h>
Public Slots | |
void | setEnumIcons (QtProperty *property, const QMap< int, QIcon > &icons) |
void | setEnumNames (QtProperty *property, const QStringList &names) |
void | setValue (QtProperty *property, int val) |
Signals | |
void | enumIconsChanged (QtProperty *property, const QMap< int, QIcon > &icons) |
void | enumNamesChanged (QtProperty *property, const QStringList &names) |
void | valueChanged (QtProperty *property, int 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 | |
QMap< int, QIcon > | enumIcons (const QtProperty *property) const |
QStringList | enumNames (const QtProperty *property) const |
QtEnumPropertyManager (QObject *parent=nullptr) | |
int | value (const QtProperty *property) const |
~QtEnumPropertyManager () override | |
Public Member Functions inherited from QtAbstractPropertyManager | |
QtProperty * | addProperty (const QString &name=QString()) |
void | clear () const |
QSet< QtProperty * > | properties () const |
QtAbstractPropertyManager (QObject *parent=nullptr) | |
~QtAbstractPropertyManager () override | |
Protected Member Functions | |
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 QtProperty * | createProperty () |
virtual QString | displayText (const QtProperty *property) const |
virtual EchoMode | echoMode (const QtProperty *) const |
virtual bool | hasValue (const QtProperty *property) const |
The QtEnumPropertyManager provides and manages enum properties.
Each enum property has an associated list of enum names which can be retrieved using the enumNames() function, and set using the corresponding setEnumNames() function. An enum property's value is represented by an index in this list, and can be retrieved and set using the value() and setValue() slots respectively.
Each enum value can also have an associated icon. The mapping from values to icons can be set using the setEnumIcons() function and queried with the enumIcons() function.
In addition, QtEnumPropertyManager provides the valueChanged() signal which is emitted whenever a property created by this manager changes. The enumNamesChanged() or enumIconsChanged() signal is emitted whenever the list of enum names or icons is altered.
QtEnumPropertyManager::QtEnumPropertyManager | ( | QObject * | parent = nullptr | ) |
Creates a manager with the given parent.
|
override |
Destroys this manager, and all the properties it has created.
References QtAbstractPropertyManager::clear().
QMap< int, QIcon > QtEnumPropertyManager::enumIcons | ( | const QtProperty * | property | ) | const |
Returns the given property's map of enum values to their icons.
References QtEnumPropertyManagerPrivate::Data::enumIcons, and QtEnumPropertyManagerPrivate::m_values.
Referenced by QtEnumEditorFactory::createEditor(), setEnumIcons(), and QtEnumEditorFactoryPrivate::slotEnumNamesChanged().
|
signal |
This signal is emitted whenever a property created by this manager changes its enum icons, passing a pointer to the property and the new mapping of values to icons as parameters.
Referenced by setEnumIcons().
QStringList QtEnumPropertyManager::enumNames | ( | const QtProperty * | property | ) | const |
Returns the given property's list of enum names.
References QtEnumPropertyManagerPrivate::Data::enumNames, and QtEnumPropertyManagerPrivate::m_values.
Referenced by QtEnumEditorFactory::createEditor(), setEnumNames(), and QtEnumEditorFactoryPrivate::slotEnumIconsChanged().
|
signal |
This signal is emitted whenever a property created by this manager changes its enum names, passing a pointer to the property and the new names as parameters.
Referenced by setEnumNames().
|
overrideprotectedvirtual |
|
slot |
Sets the given property's map of enum values to their icons to enumIcons.
Each enum value can have associated icon. This association is represented with passed enumIcons map.
References enumIcons(), enumIconsChanged(), QtEnumPropertyManagerPrivate::m_values, and QtAbstractPropertyManager::propertyChanged().
Referenced by QtCursorEditorFactory::createEditor(), and main().
|
slot |
Sets the given property's list of enum names to enumNames. The property's current value is reset to 0 indicating the first item of the list.
If the specified enumNames list is empty, the property's current value is set to -1.
References QtEnumPropertyManagerPrivate::Data::enumNames, enumNames(), enumNamesChanged(), QtEnumPropertyManagerPrivate::m_values, QtAbstractPropertyManager::propertyChanged(), QtEnumPropertyManagerPrivate::Data::val, and valueChanged().
Referenced by QtCursorEditorFactory::createEditor(), QtLocalePropertyManager::initializeProperty(), QtSizePolicyPropertyManager::initializeProperty(), QtFontPropertyManager::initializeProperty(), main(), QtLocalePropertyManager::setValue(), and QtFontPropertyManagerPrivate::slotFontDatabaseDelayedChange().
|
slot |
Sets the value of the given property to value.
The specified value must be less than the size of the given property's enumNames() list, and larger than (or equal to) 0.
References QtEnumPropertyManagerPrivate::Data::enumNames, QtEnumPropertyManagerPrivate::m_values, QtAbstractPropertyManager::propertyChanged(), QtEnumPropertyManagerPrivate::Data::val, and valueChanged().
Referenced by QtCursorEditorFactory::createEditor(), QtLocalePropertyManager::initializeProperty(), QtSizePolicyPropertyManager::initializeProperty(), QtFontPropertyManager::initializeProperty(), QtFontPropertyManager::setValue(), QtLocalePropertyManager::setValue(), QtSizePolicyPropertyManager::setValue(), QtFontPropertyManagerPrivate::slotFontDatabaseDelayedChange(), QtCursorEditorFactoryPrivate::slotPropertyChanged(), and QtEnumEditorFactoryPrivate::slotSetValue().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QtAbstractPropertyManager.
References QtEnumPropertyManagerPrivate::m_values.
int QtEnumPropertyManager::value | ( | const QtProperty * | property | ) | const |
Returns the given property's value which is an index in the list returned by enumNames()
If the given property is not managed by this manager, this function returns -1.
References QtEnumPropertyManagerPrivate::m_values.
Referenced by QtEnumEditorFactory::createEditor(), QtLocalePropertyManagerPrivate::slotEnumChanged(), QtEnumEditorFactoryPrivate::slotEnumIconsChanged(), QtEnumEditorFactoryPrivate::slotEnumNamesChanged(), and QtFontPropertyManagerPrivate::slotFontDatabaseDelayedChange().
|
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.
Referenced by setEnumNames(), and setValue().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QtAbstractPropertyManager.
References QtEnumPropertyManagerPrivate::Data::enumIcons, QtEnumPropertyManagerPrivate::m_values, and QtEnumPropertyManagerPrivate::Data::val.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QtAbstractPropertyManager.
References QtEnumPropertyManagerPrivate::Data::enumNames, QtEnumPropertyManagerPrivate::m_values, and QtEnumPropertyManagerPrivate::Data::val.