1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/qgspropertyoverridebutton.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12class QgsPropertyOverrideButton: QToolButton 13{ 14%Docstring(signature="appended") 15A button for controlling property overrides which may apply to a widget. 16 17:py:class:`QgsPropertyOverrideButton` is designed to be used alongside the QGIS 18properties framework (:py:class:`QgsProperty`, :py:class:`QgsPropertyDefinition` 19and :py:class:`QgsPropertyCollection`). 20 21It allows users to specify field or expression based overrides 22which should be applied to a property of an object. Eg, this widget 23is used for controlling data defined overrides in symbology, labeling 24and layouts. 25 26.. versionadded:: 3.0 27%End 28 29%TypeHeaderCode 30#include "qgspropertyoverridebutton.h" 31%End 32 public: 33 34 QgsPropertyOverrideButton( QWidget *parent /TransferThis/ = 0, 35 const QgsVectorLayer *layer = 0 ); 36%Docstring 37Constructor for QgsPropertyOverrideButton. 38 39:param parent: parent widget 40:param layer: associated vector layer 41%End 42 43 void init( int propertyKey, 44 const QgsProperty &property, 45 const QgsPropertiesDefinition &definitions, 46 const QgsVectorLayer *layer = 0, 47 bool auxiliaryStorageEnabled = false ); 48%Docstring 49Initialize a newly constructed property button (useful if button was included in a UI layout). 50 51:param propertyKey: key for corresponding property 52:param property: initial value of associated property to show in widget 53:param definitions: properties definitions for corresponding collection 54:param layer: associated vector layer 55:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage 56%End 57 58 void init( int propertyKey, 59 const QgsProperty &property, 60 const QgsPropertyDefinition &definition, 61 const QgsVectorLayer *layer = 0, 62 bool auxiliaryStorageEnabled = false ); 63%Docstring 64Initialize a newly constructed property button (useful if button was included in a UI layout). 65 66:param propertyKey: key for corresponding property 67:param property: initial value of associated property to show in widget 68:param definition: properties definition for button 69:param layer: associated vector layer 70:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage 71%End 72 73 void init( int propertyKey, 74 const QgsAbstractPropertyCollection &collection, 75 const QgsPropertiesDefinition &definitions, 76 const QgsVectorLayer *layer = 0, 77 bool auxiliaryStorageEnabled = false ); 78%Docstring 79Initialize a newly constructed property button (useful if button was included in a UI layout). 80 81:param propertyKey: key for corresponding property 82:param collection: associated property collection 83:param definitions: properties definitions for collection 84:param layer: associated vector layer 85:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage 86%End 87 88 QgsProperty toProperty() const; 89%Docstring 90Returns a :py:class:`QgsProperty` object encapsulating the current state of the 91widget. 92 93.. seealso:: :py:func:`setToProperty` 94%End 95 96 void setToProperty( const QgsProperty &property ); 97%Docstring 98Sets the widget to reflect the current state of a :py:class:`QgsProperty`. 99%End 100 101 int propertyKey() const; 102%Docstring 103Returns the property key linked to the button. 104%End 105 106 bool isActive() const; 107%Docstring 108Returns ``True`` if the button has an active property. 109%End 110 111 QgsPropertyDefinition::DataType validDataType() const; 112%Docstring 113Returns the data type which the widget will accept. This is used to filter 114out fields from the associated vector layer to only show fields which 115are compatible with the property. 116%End 117 118 QString fullDescription() const; 119%Docstring 120Returns the full definition description and current definition 121(internally generated on a contextual basis). 122%End 123 124 QString usageInfo() const; 125%Docstring 126Returns usage information for the property. 127 128.. seealso:: :py:func:`setUsageInfo` 129%End 130 131 void setUsageInfo( const QString &info ); 132%Docstring 133Set the usage information for the property. 134 135.. seealso:: :py:func:`usageInfo` 136%End 137 138 void setVectorLayer( const QgsVectorLayer *layer ); 139%Docstring 140Sets the vector layer associated with the button. This controls which fields are 141displayed within the widget's pop up menu. 142 143.. seealso:: :py:func:`vectorLayer` 144%End 145 146 const QgsVectorLayer *vectorLayer() const; 147%Docstring 148Returns the vector layer associated with the button. This controls which fields are 149displayed within the widget's pop up menu. 150 151.. seealso:: :py:func:`setVectorLayer` 152%End 153 154 void registerCheckedWidget( QWidget *widget, bool natural = true ); 155%Docstring 156Register a sibling ``widget`` that gets checked when the property is active. 157if ``natural`` is ``False``, widget gets unchecked when the property is active. 158 159.. note:: 160 161 this should be called after calling :py:func:`~QgsPropertyOverrideButton.init` to be correctly initialized. 162%End 163 164 void registerEnabledWidget( QWidget *widget, bool natural = true ); 165%Docstring 166Register a sibling ``widget`` that gets enabled when the property is active, and disabled when the property is inactive. 167if ``natural`` is ``False``, widget gets disabled when the property is active, and enabled when the property is inactive. 168 169.. note:: 170 171 this should be called after calling :py:func:`~QgsPropertyOverrideButton.init` to be correctly initialized. 172%End 173 174 void registerVisibleWidget( QWidget *widget, bool natural = true ); 175%Docstring 176Register a sibling ``widget`` that gets visible when the property is active, and hidden when the property is inactive. 177if ``natural`` is ``False``, widget gets hidden when the property is active, and visible when the property is inactive. 178 179.. note:: 180 181 this should be called after calling :py:func:`~QgsPropertyOverrideButton.init` to be correctly initialized. 182%End 183 184 void registerExpressionWidget( QWidget *widget ); 185%Docstring 186Register a sibling ``widget`` (line edit, text edit) that will receive the property as an expression 187 188.. note:: 189 190 this should be called after calling :py:func:`~QgsPropertyOverrideButton.init` to be correctly initialized. 191%End 192 193 void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator ); 194%Docstring 195Register an expression context generator class that will be used to retrieve 196an expression context for the button when required. 197%End 198 199 void registerLinkedWidget( QWidget *widget ); 200%Docstring 201Registers a ``widget`` which is linked to this button. The meaning of linked widgets 202depends on the property type, and the type of linked widget. 203 204For color properties, linking a :py:class:`QgsColorButton` allows the color button to correctly 205reflect the status of the property when it's set to follow a project color. 206 207.. versionadded:: 3.6 208%End 209 210 void updateFieldLists(); 211%Docstring 212Updates list of fields. 213 214.. versionadded:: 3.0 215%End 216 217 218 public slots: 219 220 void setActive( bool active ); 221%Docstring 222Set whether the current property override definition is to be used 223%End 224 225 226 227 void aboutToShowMenu(); 228 void menuActionTriggered( QAction *action ); 229 230 231 signals: 232 233 void changed(); 234%Docstring 235Emitted when property definition changes 236%End 237 238 void activated( bool isActive ); 239%Docstring 240Emitted when the activated status of the widget changes 241%End 242 243 void createAuxiliaryField(); 244%Docstring 245Emitted when creating a new auxiliary field 246%End 247 248 protected: 249 virtual void mouseReleaseEvent( QMouseEvent *event ); 250 251 252}; 253 254/************************************************************************ 255 * This file has been generated automatically from * 256 * * 257 * src/gui/qgspropertyoverridebutton.h * 258 * * 259 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 260 ************************************************************************/ 261