Workspace 6.21.5
|
#include <Workspace/Widgets/propertysetter.h>
Public Slots | |
void | setPropertyName (const QString &name) |
void | updateProperty () |
Signals | |
void | propertyNameChanged (QString newName) |
void | propertyUpdated () |
Public Member Functions | |
const QString & | getPropertyName () const |
Protected Member Functions | |
PropertySetter (QWidget *parent=nullptr) | |
virtual QVariant | getValueAsVariant () const =0 |
virtual void | notifyPropertyUpdate ()=0 |
Properties | |
QString | propertyName |
|
protected |
const QString & getPropertyName | ( | ) | const |
|
protectedpure virtual |
This function will be called by updateProperty() if a property name has been set. Note that getValueAsVariant() will not be called by updateProperty() if the property name is empty, but notifyPropertyUpdate() will.
Implemented in PropertySetterDataCollection, PropertySetterBool, PropertySetterInt, PropertySetterObjectArray, PropertySetterQreal, and PropertySetterString.
|
protectedpure virtual |
Subclasses must implement this function to emit a valueChanged() signal with the appropriate parameter type. Since this base class only knows about QVariant, it cannot emit this signal for itself when updateProperty() is called, hence why subclasses must do this instead. The notifyPropertyUpdate() function will always be called exactly once by each call to updateProperty().
Implemented in PropertySetterDataCollection, PropertySetterBool, PropertySetterInt, PropertySetterObjectArray, PropertySetterQreal, and PropertySetterString.
|
signal |
|
signal |
|
slot |
|
slot |
This function serves two related purposes. First, it will call notifyPropertyUpdate() to tell the subclass to emit the relevant signal with the appropriate parameter type. This will occur even if the value has not changed from the previous call and subclasses are not allowed to conditionally emit the signal based on whether the value has changed or not - the signal must always be emitted.
After notifyPropertyUpdate() has returned, this function will update the named property of all child widgets so that the property has the same value as returned by getValueAsVariant(). If no property name is currently set, getValueAsVariant() will not be called and the widget tree will not be traversed.
After the named property has been updated in all child widgets, the propertyUpdated() signal will be emitted. This allows interested parties to respond at a point where they know the child widgets have been updated.
updateProperty() will be called automatically whenever the value or the property name is changed, so user code would rarely need to call this function directly. The main reason it would be called directly is if a child widget has been added to the property setter widget, or if a dynamic property is added to an existing child widget (neither situation is automatically detected).
Note that the property is set by calling QWidget::setProperty(). This will ensure that a QDynamicPropertyChangeEvent will be raised for that property and thus event filters on the child widgets will be able to detect the change.
|
readwrite |