QGIS API Documentation
3.18.1-Zürich (202f1bf7e5)
|
A button for controlling property overrides which may apply to a widget. More...
#include <qgspropertyoverridebutton.h>
Public Slots | |
void | setActive (bool active) |
Set whether the current property override definition is to be used. More... | |
Signals | |
void | activated (bool isActive) |
Emitted when the activated status of the widget changes. More... | |
void | changed () |
Emitted when property definition changes. More... | |
void | createAuxiliaryField () |
Emitted when creating a new auxiliary field. More... | |
Public Member Functions | |
QgsPropertyOverrideButton (QWidget *parent=nullptr, const QgsVectorLayer *layer=nullptr) | |
Constructor for QgsPropertyOverrideButton. More... | |
QString | fullDescription () const |
Returns the full definition description and current definition (internally generated on a contextual basis). More... | |
void | init (int propertyKey, const QgsAbstractPropertyCollection &collection, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer=nullptr, bool auxiliaryStorageEnabled=false) |
Initialize a newly constructed property button (useful if button was included in a UI layout). More... | |
void | init (int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer=nullptr, bool auxiliaryStorageEnabled=false) |
Initialize a newly constructed property button (useful if button was included in a UI layout). More... | |
void | init (int propertyKey, const QgsProperty &property, const QgsPropertyDefinition &definition, const QgsVectorLayer *layer=nullptr, bool auxiliaryStorageEnabled=false) |
Initialize a newly constructed property button (useful if button was included in a UI layout). More... | |
bool | isActive () const |
Returns true if the button has an active property. More... | |
int | propertyKey () const |
Returns the property key linked to the button. More... | |
void | registerCheckedWidget (QWidget *widget, bool natural=true) |
Register a sibling widget that gets checked when the property is active. More... | |
void | registerEnabledWidget (QWidget *widget, bool natural=true) |
Register a sibling widget that gets enabled when the property is active, and disabled when the property is inactive. More... | |
void | registerExpressionContextGenerator (QgsExpressionContextGenerator *generator) |
Register an expression context generator class that will be used to retrieve an expression context for the button when required. More... | |
void | registerExpressionWidget (QWidget *widget) |
Register a sibling widget (line edit, text edit) that will receive the property as an expression. More... | |
void | registerLinkedWidget (QWidget *widget) |
Registers a widget which is linked to this button. More... | |
void | registerVisibleWidget (QWidget *widget, bool natural=true) |
Register a sibling widget that gets visible when the property is active, and hidden when the property is inactive. More... | |
void | setSymbol (std::shared_ptr< QgsSymbol > symbol) |
Sets a symbol which can be used for previews inside the widget or in any dialog created by the widget. More... | |
void | setToProperty (const QgsProperty &property) |
Sets the widget to reflect the current state of a QgsProperty. More... | |
void | setUsageInfo (const QString &info) |
Set the usage information for the property. More... | |
void | setVectorLayer (const QgsVectorLayer *layer) |
Sets the vector layer associated with the button. More... | |
QgsProperty | toProperty () const |
Returns a QgsProperty object encapsulating the current state of the widget. More... | |
void | updateFieldLists () |
Updates list of fields. More... | |
QString | usageInfo () const |
Returns usage information for the property. More... | |
QgsPropertyDefinition::DataType | validDataType () const |
Returns the data type which the widget will accept. More... | |
const QgsVectorLayer * | vectorLayer () const |
Returns the vector layer associated with the button. More... | |
Protected Member Functions | |
void | mouseReleaseEvent (QMouseEvent *event) override |
Properties | |
bool | active |
QString | usageInfo |
A button for controlling property overrides which may apply to a widget.
QgsPropertyOverrideButton is designed to be used alongside the QGIS properties framework (QgsProperty, QgsPropertyDefinition and QgsPropertyCollection).
It allows users to specify field or expression based overrides which should be applied to a property of an object. Eg, this widget is used for controlling data defined overrides in symbology, labeling and layouts.
Definition at line 50 of file qgspropertyoverridebutton.h.
QgsPropertyOverrideButton::QgsPropertyOverrideButton | ( | QWidget * | parent = nullptr , |
const QgsVectorLayer * | layer = nullptr |
||
) |
Constructor for QgsPropertyOverrideButton.
parent | parent widget |
layer | associated vector layer |
Definition at line 37 of file qgspropertyoverridebutton.cpp.
|
signal |
Emitted when the activated status of the widget changes.
|
signal |
Emitted when property definition changes.
|
signal |
Emitted when creating a new auxiliary field.
|
inline |
Returns the full definition description and current definition (internally generated on a contextual basis).
Definition at line 141 of file qgspropertyoverridebutton.h.
void QgsPropertyOverrideButton::init | ( | int | propertyKey, |
const QgsAbstractPropertyCollection & | collection, | ||
const QgsPropertiesDefinition & | definitions, | ||
const QgsVectorLayer * | layer = nullptr , |
||
bool | auxiliaryStorageEnabled = false |
||
) |
Initialize a newly constructed property button (useful if button was included in a UI layout).
propertyKey | key for corresponding property |
collection | associated property collection |
definitions | properties definitions for collection |
layer | associated vector layer |
auxiliaryStorageEnabled | If true , activate the button to store data defined in auxiliary storage |
Definition at line 146 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::init | ( | int | propertyKey, |
const QgsProperty & | property, | ||
const QgsPropertiesDefinition & | definitions, | ||
const QgsVectorLayer * | layer = nullptr , |
||
bool | auxiliaryStorageEnabled = false |
||
) |
Initialize a newly constructed property button (useful if button was included in a UI layout).
propertyKey | key for corresponding property |
property | initial value of associated property to show in widget |
definitions | properties definitions for corresponding collection |
layer | associated vector layer |
auxiliaryStorageEnabled | If true , activate the button to store data defined in auxiliary storage |
Definition at line 96 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::init | ( | int | propertyKey, |
const QgsProperty & | property, | ||
const QgsPropertyDefinition & | definition, | ||
const QgsVectorLayer * | layer = nullptr , |
||
bool | auxiliaryStorageEnabled = false |
||
) |
Initialize a newly constructed property button (useful if button was included in a UI layout).
propertyKey | key for corresponding property |
property | initial value of associated property to show in widget |
definition | properties definition for button |
layer | associated vector layer |
auxiliaryStorageEnabled | If true , activate the button to store data defined in auxiliary storage |
Definition at line 101 of file qgspropertyoverridebutton.cpp.
|
inline |
Returns true
if the button has an active property.
Definition at line 128 of file qgspropertyoverridebutton.h.
|
overrideprotected |
Definition at line 269 of file qgspropertyoverridebutton.cpp.
|
inline |
Returns the property key linked to the button.
Definition at line 123 of file qgspropertyoverridebutton.h.
void QgsPropertyOverrideButton::registerCheckedWidget | ( | QWidget * | widget, |
bool | natural = true |
||
) |
Register a sibling widget that gets checked when the property is active.
if natural is false
, widget gets unchecked when the property is active.
Definition at line 220 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::registerEnabledWidget | ( | QWidget * | widget, |
bool | natural = true |
||
) |
Register a sibling widget that gets enabled when the property is active, and disabled when the property is inactive.
if natural is false
, widget gets disabled when the property is active, and enabled when the property is inactive.
Definition at line 232 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::registerExpressionContextGenerator | ( | QgsExpressionContextGenerator * | generator | ) |
Register an expression context generator class that will be used to retrieve an expression context for the button when required.
Definition at line 954 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::registerExpressionWidget | ( | QWidget * | widget | ) |
Register a sibling widget (line edit, text edit) that will receive the property as an expression.
Definition at line 256 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::registerLinkedWidget | ( | QWidget * | widget | ) |
Registers a widget which is linked to this button.
The meaning of linked widgets depends on the property type, and the type of linked widget.
For color properties, linking a QgsColorButton allows the color button to correctly reflect the status of the property when it's set to follow a project color.
Definition at line 959 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::registerVisibleWidget | ( | QWidget * | widget, |
bool | natural = true |
||
) |
Register a sibling widget that gets visible when the property is active, and hidden when the property is inactive.
if natural is false
, widget gets hidden when the property is active, and visible when the property is inactive.
Definition at line 244 of file qgspropertyoverridebutton.cpp.
|
slot |
Set whether the current property override definition is to be used.
Definition at line 944 of file qgspropertyoverridebutton.cpp.
|
inline |
Sets a symbol which can be used for previews inside the widget or in any dialog created by the widget.
If not specified, a default created symbol will be used instead.
Definition at line 225 of file qgspropertyoverridebutton.h.
void QgsPropertyOverrideButton::setToProperty | ( | const QgsProperty & | property | ) |
Sets the widget to reflect the current state of a QgsProperty.
Definition at line 286 of file qgspropertyoverridebutton.cpp.
|
inline |
Set the usage information for the property.
Definition at line 153 of file qgspropertyoverridebutton.h.
void QgsPropertyOverrideButton::setVectorLayer | ( | const QgsVectorLayer * | layer | ) |
Sets the vector layer associated with the button.
This controls which fields are displayed within the widget's pop up menu.
Definition at line 215 of file qgspropertyoverridebutton.cpp.
QgsProperty QgsPropertyOverrideButton::toProperty | ( | ) | const |
Returns a QgsProperty object encapsulating the current state of the widget.
Definition at line 210 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::updateFieldLists | ( | ) |
|
inline |
Returns usage information for the property.
Definition at line 147 of file qgspropertyoverridebutton.h.
|
inline |
Returns the data type which the widget will accept.
This is used to filter out fields from the associated vector layer to only show fields which are compatible with the property.
Definition at line 135 of file qgspropertyoverridebutton.h.
|
inline |
Returns the vector layer associated with the button.
This controls which fields are displayed within the widget's pop up menu.
Definition at line 167 of file qgspropertyoverridebutton.h.
|
readwrite |
Definition at line 1 of file qgspropertyoverridebutton.h.
|
readwrite |
Definition at line 1 of file qgspropertyoverridebutton.h.