QGIS API Documentation 3.41.0-Master (3c143d501a8)
|
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. | |
Signals | |
void | activated (bool isActive) |
Emitted when the activated status of the widget changes. | |
void | changed () |
Emitted when property definition changes. | |
void | createAuxiliaryField () |
Emitted when creating a new auxiliary field. | |
Public Member Functions | |
QgsPropertyOverrideButton (QWidget *parent=nullptr, const QgsVectorLayer *layer=nullptr) | |
Constructor for QgsPropertyOverrideButton. | |
QString | fullDescription () const |
Returns the full definition description and current definition (internally generated on a contextual basis). | |
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). | |
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). | |
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). | |
bool | isActive () const |
Returns true if the button has an active property. | |
int | propertyKey () const |
Returns the property key linked to the button. | |
void | registerCheckedWidget (QWidget *widget, bool natural=true) |
Register a sibling widget that gets checked when the property is active. | |
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. | |
void | registerExpressionContextGenerator (QgsExpressionContextGenerator *generator) |
Register an expression context generator class that will be used to retrieve an expression context for the button when required. | |
void | registerExpressionWidget (QWidget *widget) |
Register a sibling widget (line edit, text edit) that will receive the property as an expression. | |
void | registerLinkedWidget (QWidget *widget) |
Registers a widget which is linked to this button. | |
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. | |
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. | |
void | setToProperty (const QgsProperty &property) |
Sets the widget to reflect the current state of a QgsProperty. | |
void | setUsageInfo (const QString &info) |
Set the usage information for the property. | |
void | setVectorLayer (const QgsVectorLayer *layer) |
Sets the vector layer associated with the button. | |
QgsProperty | toProperty () const |
Returns a QgsProperty object encapsulating the current state of the widget. | |
void | updateFieldLists () |
Updates list of fields. | |
QString | usageInfo () const |
Returns usage information for the property. | |
QgsPropertyDefinition::DataType | validDataType () const |
Returns the data type which the widget will accept. | |
const QgsVectorLayer * | vectorLayer () const |
Returns the vector layer associated with the button. | |
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 48 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 38 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 139 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 153 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 103 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 108 of file qgspropertyoverridebutton.cpp.
|
inline |
Returns true
if the button has an active property.
Definition at line 126 of file qgspropertyoverridebutton.h.
|
overrideprotected |
Definition at line 260 of file qgspropertyoverridebutton.cpp.
|
inline |
Returns the property key linked to the button.
Definition at line 121 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 211 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 223 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 958 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 247 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 963 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 235 of file qgspropertyoverridebutton.cpp.
|
slot |
Set whether the current property override definition is to be used.
Definition at line 947 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 222 of file qgspropertyoverridebutton.h.
void QgsPropertyOverrideButton::setToProperty | ( | const QgsProperty & | property | ) |
Sets the widget to reflect the current state of a QgsProperty.
Definition at line 284 of file qgspropertyoverridebutton.cpp.
|
inline |
Set the usage information for the property.
Definition at line 151 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 204 of file qgspropertyoverridebutton.cpp.
QgsProperty QgsPropertyOverrideButton::toProperty | ( | ) | const |
Returns a QgsProperty object encapsulating the current state of the widget.
Definition at line 199 of file qgspropertyoverridebutton.cpp.
void QgsPropertyOverrideButton::updateFieldLists | ( | ) |
Updates list of fields.
Definition at line 159 of file qgspropertyoverridebutton.cpp.
|
inline |
Returns usage information for the property.
Definition at line 145 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 133 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 165 of file qgspropertyoverridebutton.h.
|
readwrite |
Definition at line 52 of file qgspropertyoverridebutton.h.
|
readwrite |
Definition at line 51 of file qgspropertyoverridebutton.h.