Skip to content

Commit 618baf9

Browse files
committed
Small refactor of QgsPropertyOverrideButton
1 parent 6b23e1f commit 618baf9

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

python/gui/qgspropertyoverridebutton.sip

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ class QgsPropertyOverrideButton: QToolButton
5353
\param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
5454
%End
5555

56+
void init( int propertyKey,
57+
const QgsProperty &property,
58+
const QgsPropertyDefinition &definition,
59+
const QgsVectorLayer *layer = 0,
60+
bool auxiliaryStorageEnabled = false );
61+
%Docstring
62+
Initialize a newly constructed property button (useful if button was included in a UI layout).
63+
\param propertyKey key for corresponding property
64+
\param property initial value of associated property to show in widget
65+
\param definition properties definition for button
66+
\param layer associated vector layer
67+
\param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
68+
%End
69+
5670
void init( int propertyKey,
5771
const QgsAbstractPropertyCollection &collection,
5872
const QgsPropertiesDefinition &definitions,

src/gui/qgspropertyoverridebutton.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,18 @@ QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,
8888

8989

9090
void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
91+
{
92+
init( propertyKey, property, definitions.value( propertyKey ), layer, auxiliaryStorageEnabled );
93+
}
94+
95+
void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertyDefinition &definition, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
9196
{
9297
mVectorLayer = layer;
9398
mAuxiliaryStorageEnabled = auxiliaryStorageEnabled;
9499
setToProperty( property );
95100
mPropertyKey = propertyKey;
96101

97-
mDefinition = definitions.value( propertyKey );
102+
mDefinition = definition;
98103
mDataTypes = mDefinition.dataType();
99104

100105
mInputDescription = mDefinition.helpText();

src/gui/qgspropertyoverridebutton.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ class GUI_EXPORT QgsPropertyOverrideButton: public QToolButton
7777
const QgsVectorLayer *layer = nullptr,
7878
bool auxiliaryStorageEnabled = false );
7979

80+
/**
81+
* Initialize a newly constructed property button (useful if button was included in a UI layout).
82+
* \param propertyKey key for corresponding property
83+
* \param property initial value of associated property to show in widget
84+
* \param definition properties definition for button
85+
* \param layer associated vector layer
86+
* \param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
87+
*/
88+
void init( int propertyKey,
89+
const QgsProperty &property,
90+
const QgsPropertyDefinition &definition,
91+
const QgsVectorLayer *layer = nullptr,
92+
bool auxiliaryStorageEnabled = false );
93+
8094
/**
8195
* Initialize a newly constructed property button (useful if button was included in a UI layout).
8296
* \param propertyKey key for corresponding property

0 commit comments

Comments
 (0)