Skip to content

Commit

Permalink
Small refactor of QgsPropertyOverrideButton
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 2, 2017
1 parent 6b23e1f commit 618baf9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
14 changes: 14 additions & 0 deletions python/gui/qgspropertyoverridebutton.sip
Expand Up @@ -53,6 +53,20 @@ class QgsPropertyOverrideButton: QToolButton
\param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
%End

void init( int propertyKey,
const QgsProperty &property,
const QgsPropertyDefinition &definition,
const QgsVectorLayer *layer = 0,
bool auxiliaryStorageEnabled = false );
%Docstring
Initialize a newly constructed property button (useful if button was included in a UI layout).
\param propertyKey key for corresponding property
\param property initial value of associated property to show in widget
\param definition properties definition for button
\param layer associated vector layer
\param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
%End

void init( int propertyKey,
const QgsAbstractPropertyCollection &collection,
const QgsPropertiesDefinition &definitions,
Expand Down
7 changes: 6 additions & 1 deletion src/gui/qgspropertyoverridebutton.cpp
Expand Up @@ -88,13 +88,18 @@ QgsPropertyOverrideButton::QgsPropertyOverrideButton( QWidget *parent,


void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertiesDefinition &definitions, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
{
init( propertyKey, property, definitions.value( propertyKey ), layer, auxiliaryStorageEnabled );
}

void QgsPropertyOverrideButton::init( int propertyKey, const QgsProperty &property, const QgsPropertyDefinition &definition, const QgsVectorLayer *layer, bool auxiliaryStorageEnabled )
{
mVectorLayer = layer;
mAuxiliaryStorageEnabled = auxiliaryStorageEnabled;
setToProperty( property );
mPropertyKey = propertyKey;

mDefinition = definitions.value( propertyKey );
mDefinition = definition;
mDataTypes = mDefinition.dataType();

mInputDescription = mDefinition.helpText();
Expand Down
14 changes: 14 additions & 0 deletions src/gui/qgspropertyoverridebutton.h
Expand Up @@ -77,6 +77,20 @@ class GUI_EXPORT QgsPropertyOverrideButton: public QToolButton
const QgsVectorLayer *layer = nullptr,
bool auxiliaryStorageEnabled = false );

/**
* Initialize a newly constructed property button (useful if button was included in a UI layout).
* \param propertyKey key for corresponding property
* \param property initial value of associated property to show in widget
* \param definition properties definition for button
* \param layer associated vector layer
* \param auxiliaryStorageEnabled If true, activate the button to store data defined in auxiliary storage
*/
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).
* \param propertyKey key for corresponding property
Expand Down

0 comments on commit 618baf9

Please sign in to comment.