Follow up 4a3871, fix broken data defined properties

(definitions are often accessed before a QgsSymboLayer/etc
is constructed)
This commit is contained in:
Nyall Dawson 2017-02-05 14:23:03 +10:00
parent fa8189a53c
commit 54089ff710
23 changed files with 128 additions and 59 deletions

View File

@ -60,7 +60,11 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
ScalebarLineWidth, //!< Scalebar line width
};
static const QgsPropertiesDefinition PROPERTY_DEFINITIONS;
/**
* Returns the composer object property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
/** Specifies whether the value returned by a function should be the original, user
* set value, or the current evaluated value for the property. This may differ if

View File

@ -53,6 +53,12 @@ class QgsDiagramLayerSettings
StartAngle, /*! Angle offset for pie diagram */
};
/**
* Returns the diagram property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
QgsDiagramLayerSettings();
//! Copy constructor
@ -209,7 +215,6 @@ class QgsDiagramLayerSettings
void setDataDefinedProperties( const QgsPropertyCollection& collection );
static const QgsPropertiesDefinition PROPERTY_DEFINITIONS;
};

View File

@ -270,6 +270,12 @@ class QgsPalLayerSettings
AlwaysShow
};
/**
* Returns the labeling property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
// whether to label this layer
bool enabled;
@ -460,8 +466,6 @@ class QgsPalLayerSettings
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
static const QgsPropertiesDefinition PROPERTY_DEFINITIONS;
};
class QgsLabelCandidate

View File

@ -122,7 +122,11 @@ class QgsSymbolLayer
PropertyArrowType, //!< Arrow type
};
static const QgsPropertiesDefinition PROPERTY_DEFINITIONS;
/**
* Returns the symbol layer property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
virtual ~QgsSymbolLayer();

View File

@ -77,7 +77,7 @@ void QgsComposerConfigObject::updateDataDefinedButtons()
void QgsComposerConfigObject::initializeDataDefinedButton( QgsPropertyOverrideButton* button, QgsComposerObject::DataDefinedProperty key )
{
button->blockSignals( true );
button->init( key, mComposerObject->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, atlasCoverageLayer() );
button->init( key, mComposerObject->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), atlasCoverageLayer() );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsComposerConfigObject::updateDataDefinedProperty );
button->registerExpressionContextGenerator( mComposerObject );
button->blockSignals( false );

View File

@ -156,11 +156,11 @@ void QgsCompositionWidget::populateDataDefinedButtons()
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsCompositionWidget::updateDataDefinedProperty );
}
mPaperSizeDDBtn->init( QgsComposerObject::PresetPaperSize, mComposition->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, vl );
mPaperWidthDDBtn->init( QgsComposerObject::PaperWidth, mComposition->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, vl );
mPaperHeightDDBtn->init( QgsComposerObject::PaperHeight, mComposition->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, vl );
mNumPagesDDBtn->init( QgsComposerObject::NumPages, mComposition->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, vl );
mPaperOrientationDDBtn->init( QgsComposerObject::PaperOrientation, mComposition->dataDefinedProperties(), QgsComposerObject::PROPERTY_DEFINITIONS, vl );
mPaperSizeDDBtn->init( QgsComposerObject::PresetPaperSize, mComposition->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), vl );
mPaperWidthDDBtn->init( QgsComposerObject::PaperWidth, mComposition->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), vl );
mPaperHeightDDBtn->init( QgsComposerObject::PaperHeight, mComposition->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), vl );
mNumPagesDDBtn->init( QgsComposerObject::NumPages, mComposition->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), vl );
mPaperOrientationDDBtn->init( QgsComposerObject::PaperOrientation, mComposition->dataDefinedProperties(), QgsComposerObject::propertyDefinitions(), vl );
//initial state of controls - disable related controls when dd buttons are active
mPaperSizeComboBox->setEnabled( !mPaperSizeDDBtn->isActive() );

View File

@ -429,7 +429,7 @@ QgsDiagramProperties::~QgsDiagramProperties()
void QgsDiagramProperties::registerDataDefinedButton( QgsPropertyOverrideButton * button, QgsDiagramLayerSettings::Property key )
{
button->init( key, mDataDefinedProperties, QgsDiagramLayerSettings::PROPERTY_DEFINITIONS, mLayer );
button->init( key, mDataDefinedProperties, QgsDiagramLayerSettings::propertyDefinitions(), mLayer );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsDiagramProperties::updateProperty );
button->registerExpressionContextGenerator( this );
}

View File

@ -44,7 +44,7 @@ QgsExpressionContext QgsLabelingGui::createExpressionContext() const
void QgsLabelingGui::registerDataDefinedButton( QgsPropertyOverrideButton* button, QgsPalLayerSettings::Property key )
{
button->init( key, mDataDefinedProperties, QgsPalLayerSettings::PROPERTY_DEFINITIONS, mLayer );
button->init( key, mDataDefinedProperties, QgsPalLayerSettings::propertyDefinitions(), mLayer );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLabelingGui::updateProperty );
button->registerExpressionContextGenerator( this );
}

View File

@ -23,14 +23,14 @@
#include "qgsproject.h"
#include "qgsvectorlayer.h"
QgsPropertiesDefinition QgsComposerObject::PROPERTY_DEFINITIONS;
QgsPropertiesDefinition QgsComposerObject::sPropertyDefinitions;
void QgsComposerObject::initPropertyDefinitions()
{
if ( !PROPERTY_DEFINITIONS.isEmpty() )
if ( !sPropertyDefinitions.isEmpty() )
return;
PROPERTY_DEFINITIONS = QgsPropertiesDefinition
sPropertyDefinitions = QgsPropertiesDefinition
{
{ QgsComposerObject::TestProperty, QgsPropertyDefinition( "dataDefinedProperty" , QgsPropertyDefinition::DataTypeString, "invalid property", QString() ) },
{ QgsComposerObject::PresetPaperSize, QgsPropertyDefinition( "dataDefinedPaperSize" , QgsPropertyDefinition::DataTypeString, QObject::tr( "Paper size" ), QObject::tr( "string " ) + QLatin1String( "[<b>A5</b>|<b>A4</b>|<b>A3</b>|<b>A2</b>|<b>A1</b>|<b>A0</b>"
@ -76,6 +76,12 @@ void QgsComposerObject::initPropertyDefinitions()
};
}
const QgsPropertiesDefinition& QgsComposerObject::propertyDefinitions()
{
QgsComposerObject::initPropertyDefinitions();
return sPropertyDefinitions;
}
QgsComposerObject::QgsComposerObject( QgsComposition* composition )
: QObject( nullptr )
, mComposition( composition )
@ -109,7 +115,7 @@ bool QgsComposerObject::writeXml( QDomElement &elem, QDomDocument &doc ) const
}
QDomElement ddPropsElement = doc.createElement( QStringLiteral( "dataDefinedProperties" ) );
mDataDefinedProperties.writeXml( ddPropsElement, doc, PROPERTY_DEFINITIONS );
mDataDefinedProperties.writeXml( ddPropsElement, doc, sPropertyDefinitions );
elem.appendChild( ddPropsElement );
//custom properties
@ -132,7 +138,7 @@ bool QgsComposerObject::readXml( const QDomElement &itemElem, const QDomDocument
QDomNode propsNode = itemElem.namedItem( QStringLiteral( "dataDefinedProperties" ) );
if ( !propsNode.isNull() )
{
mDataDefinedProperties.readXml( propsNode.toElement(), doc, PROPERTY_DEFINITIONS );
mDataDefinedProperties.readXml( propsNode.toElement(), doc, sPropertyDefinitions );
}
//custom properties

View File

@ -88,9 +88,6 @@ class CORE_EXPORT QgsComposerObject: public QObject, public QgsExpressionContext
ScalebarLineWidth, //!< Scalebar line width
};
//! Property definitions
static QgsPropertiesDefinition PROPERTY_DEFINITIONS;
/** Specifies whether the value returned by a function should be the original, user
* set value, or the current evaluated value for the property. This may differ if
* a property has a data defined expression active.
@ -101,6 +98,12 @@ class CORE_EXPORT QgsComposerObject: public QObject, public QgsExpressionContext
OriginalValue //!< Return the original, user set value
};
/**
* Returns the composer object property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
/** Constructor
* @param composition parent composition
*/
@ -229,6 +232,9 @@ class CORE_EXPORT QgsComposerObject: public QObject, public QgsExpressionContext
void prepareProperties() const;
private:
//! Property definitions
static QgsPropertiesDefinition sPropertyDefinitions;
static void initPropertyDefinitions();
friend class TestQgsComposerObject;

View File

@ -322,8 +322,8 @@ bool QgsComposerUtils::decodePresetPaperSize( const QString& presetString, doubl
void QgsComposerUtils::readOldDataDefinedPropertyMap( const QDomElement &itemElem, QgsPropertyCollection& dataDefinedProperties )
{
QgsPropertiesDefinition::const_iterator i = QgsComposerObject::PROPERTY_DEFINITIONS.constBegin();
for ( ; i != QgsComposerObject::PROPERTY_DEFINITIONS.constEnd(); ++i )
QgsPropertiesDefinition::const_iterator i = QgsComposerObject::propertyDefinitions().constBegin();
for ( ; i != QgsComposerObject::propertyDefinitions().constEnd(); ++i )
{
QString elemName = i.value().name();
QDomNodeList ddNodeList = itemElem.elementsByTagName( elemName );

View File

@ -902,7 +902,7 @@ bool QgsComposition::writeXml( QDomElement& composerElem, QDomDocument& doc )
//data defined properties
QDomElement ddPropsElement = doc.createElement( QStringLiteral( "dataDefinedProperties" ) );
mDataDefinedProperties.writeXml( ddPropsElement, doc, QgsComposerObject::PROPERTY_DEFINITIONS );
mDataDefinedProperties.writeXml( ddPropsElement, doc, QgsComposerObject::propertyDefinitions() );
compositionElem.appendChild( ddPropsElement );
composerElem.appendChild( compositionElem );
@ -989,7 +989,7 @@ bool QgsComposition::readXml( const QDomElement& compositionElem, const QDomDocu
QDomNode propsNode = compositionElem.namedItem( QStringLiteral( "dataDefinedProperties" ) );
if ( !propsNode.isNull() )
{
mDataDefinedProperties.readXml( propsNode.toElement(), doc, QgsComposerObject::PROPERTY_DEFINITIONS );
mDataDefinedProperties.readXml( propsNode.toElement(), doc, QgsComposerObject::propertyDefinitions() );
}
//custom properties

View File

@ -25,14 +25,14 @@
#include <QDomElement>
#include <QPainter>
QgsPropertiesDefinition QgsDiagramLayerSettings::PROPERTY_DEFINITIONS;
QgsPropertiesDefinition QgsDiagramLayerSettings::sPropertyDefinitions;
void QgsDiagramLayerSettings::initPropertyDefinitions()
{
if ( !PROPERTY_DEFINITIONS.isEmpty() )
if ( !sPropertyDefinitions.isEmpty() )
return;
PROPERTY_DEFINITIONS = QgsPropertiesDefinition
sPropertyDefinitions = QgsPropertiesDefinition
{
{ QgsDiagramLayerSettings::BackgroundColor, QgsPropertyDefinition( "backgroundColor", QObject::tr( "Background color" ), QgsPropertyDefinition::ColorWithAlpha ) },
{ QgsDiagramLayerSettings::OutlineColor, QgsPropertyDefinition( "outlineColor", QObject::tr( "Outline color" ), QgsPropertyDefinition::ColorWithAlpha ) },
@ -49,6 +49,12 @@ void QgsDiagramLayerSettings::initPropertyDefinitions()
};
}
const QgsPropertiesDefinition& QgsDiagramLayerSettings::propertyDefinitions()
{
initPropertyDefinitions();
return sPropertyDefinitions;
}
QgsDiagramLayerSettings::QgsDiagramLayerSettings( const QgsDiagramLayerSettings& rh )
: mCt( rh.mCt )
, mPlacement( rh.mPlacement )
@ -105,7 +111,7 @@ void QgsDiagramLayerSettings::readXml( const QDomElement& elem, const QgsVectorL
QDomNodeList propertyElems = elem.elementsByTagName( "properties" );
if ( !propertyElems.isEmpty() )
{
( void )mDataDefinedProperties.readXml( propertyElems.at( 0 ).toElement(), elem.ownerDocument(), PROPERTY_DEFINITIONS );
( void )mDataDefinedProperties.readXml( propertyElems.at( 0 ).toElement(), elem.ownerDocument(), sPropertyDefinitions );
}
else
{
@ -148,7 +154,7 @@ void QgsDiagramLayerSettings::writeXml( QDomElement& layerElem, QDomDocument& do
QDomElement diagramLayerElem = doc.createElement( QStringLiteral( "DiagramLayerSettings" ) );
QDomElement propertiesElem = doc.createElement( "properties" );
( void )mDataDefinedProperties.writeXml( propertiesElem, doc, PROPERTY_DEFINITIONS );
( void )mDataDefinedProperties.writeXml( propertiesElem, doc, sPropertyDefinitions );
diagramLayerElem.appendChild( propertiesElem );
diagramLayerElem.setAttribute( QStringLiteral( "placement" ), mPlacement );
diagramLayerElem.setAttribute( QStringLiteral( "linePlacementFlags" ), mPlacementFlags );

View File

@ -95,6 +95,12 @@ class CORE_EXPORT QgsDiagramLayerSettings
StartAngle, //! Angle offset for pie diagram
};
/**
* Returns the diagram property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
/**
* Constructor for QgsDiagramLayerSettings.
*/
@ -286,9 +292,6 @@ class CORE_EXPORT QgsDiagramLayerSettings
*/
void setDataDefinedProperties( const QgsPropertyCollection& collection ) { mDataDefinedProperties = collection; }
//! Property definitions
static QgsPropertiesDefinition PROPERTY_DEFINITIONS;
private:
//! Associated coordinate transform, or invalid transform for no transformation
@ -324,6 +327,10 @@ class CORE_EXPORT QgsDiagramLayerSettings
QgsPropertyCollection mDataDefinedProperties;
static void initPropertyDefinitions();
//! Property definitions
static QgsPropertiesDefinition sPropertyDefinitions;
};
/** \ingroup core

View File

@ -90,14 +90,14 @@ const QVector< QgsPalLayerSettings::PredefinedPointPosition > QgsPalLayerSetting
<< QgsPalLayerSettings::TopMiddle
<< QgsPalLayerSettings::BottomMiddle;*/
QgsPropertiesDefinition QgsPalLayerSettings::PROPERTY_DEFINITIONS;
QgsPropertiesDefinition QgsPalLayerSettings::sPropertyDefinitions;
void QgsPalLayerSettings::initPropertyDefinitions()
{
if ( !PROPERTY_DEFINITIONS.isEmpty() )
if ( !sPropertyDefinitions.isEmpty() )
return;
PROPERTY_DEFINITIONS = QgsPropertiesDefinition
sPropertyDefinitions = QgsPropertiesDefinition
{
{ QgsPalLayerSettings::Size, QgsPropertyDefinition( "Size" , QObject::tr( "Font size" ), QgsPropertyDefinition::DoublePositive ) },
{ QgsPalLayerSettings::Bold, QgsPropertyDefinition( "Bold", QObject::tr( "Bold style" ), QgsPropertyDefinition::Boolean ) },
@ -392,6 +392,11 @@ QgsPalLayerSettings QgsPalLayerSettings::fromLayer( QgsVectorLayer* layer )
return settings;
}
const QgsPropertiesDefinition& QgsPalLayerSettings::propertyDefinitions()
{
initPropertyDefinitions();
return sPropertyDefinitions;
}
QgsExpression* QgsPalLayerSettings::getLabelExpression()
{
@ -438,7 +443,7 @@ QString updateDataDefinedString( const QString& value )
void QgsPalLayerSettings::readOldDataDefinedProperty( QgsVectorLayer* layer, QgsPalLayerSettings::Property p )
{
QString newPropertyName = "labeling/dataDefined/" + PROPERTY_DEFINITIONS.value( p ).name();
QString newPropertyName = "labeling/dataDefined/" + sPropertyDefinitions.value( p ).name();
QVariant newPropertyField = layer->customProperty( newPropertyName, QVariant() );
if ( !newPropertyField.isValid() )
@ -476,8 +481,8 @@ void QgsPalLayerSettings::readOldDataDefinedPropertyMap( QgsVectorLayer* layer,
return;
}
QgsPropertiesDefinition::const_iterator i = PROPERTY_DEFINITIONS.constBegin();
for ( ; i != PROPERTY_DEFINITIONS.constEnd(); ++i )
QgsPropertiesDefinition::const_iterator i = sPropertyDefinitions.constBegin();
for ( ; i != sPropertyDefinitions.constEnd(); ++i )
{
if ( layer )
{
@ -650,7 +655,7 @@ void QgsPalLayerSettings::readFromLayer( QgsVectorLayer* layer )
QDomDocument doc( QStringLiteral( "dd" ) );
doc.setContent( layer->customProperty( QStringLiteral( "labeling/ddProperties" ) ).toString() );
QDomElement elem = doc.firstChildElement( QStringLiteral( "properties" ) );
mDataDefinedProperties.readXml( elem, doc, PROPERTY_DEFINITIONS );
mDataDefinedProperties.readXml( elem, doc, sPropertyDefinitions );
}
else
{
@ -741,7 +746,7 @@ void QgsPalLayerSettings::writeToLayer( QgsVectorLayer* layer )
doc = QDomDocument( QStringLiteral( "dd" ) );
QDomElement ddElem = doc.createElement( QStringLiteral( "properties" ) );
mDataDefinedProperties.writeXml( ddElem, doc, PROPERTY_DEFINITIONS );
mDataDefinedProperties.writeXml( ddElem, doc, sPropertyDefinitions );
QString ddProps;
QTextStream streamProps( &ddProps );
ddElem.save( streamProps, -1 );
@ -857,7 +862,7 @@ void QgsPalLayerSettings::readXml( QDomElement& elem )
QDomElement ddElem = elem.firstChildElement( QStringLiteral( "dd_properties" ) );
if ( !ddElem.isNull() )
{
mDataDefinedProperties.readXml( ddElem, ddElem.ownerDocument(), PROPERTY_DEFINITIONS );
mDataDefinedProperties.readXml( ddElem, ddElem.ownerDocument(), sPropertyDefinitions );
}
else
{
@ -946,7 +951,7 @@ QDomElement QgsPalLayerSettings::writeXml( QDomDocument& doc )
renderingElem.setAttribute( QStringLiteral( "zIndex" ), zIndex );
QDomElement ddElem = doc.createElement( QStringLiteral( "dd_properties" ) );
mDataDefinedProperties.writeXml( ddElem, doc, PROPERTY_DEFINITIONS );
mDataDefinedProperties.writeXml( ddElem, doc, sPropertyDefinitions );
QDomElement elem = doc.createElement( QStringLiteral( "settings" ) );
elem.appendChild( textStyleElem );

View File

@ -371,6 +371,13 @@ class CORE_EXPORT QgsPalLayerSettings
AlwaysShow = 20
};
/**
* Returns the labeling property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
// whether to label this layer
bool enabled;
@ -574,9 +581,6 @@ class CORE_EXPORT QgsPalLayerSettings
int mFeatsSendingToPal; // total features tested for sending into PAL (relative to maxNumLabels)
int mFeatsRegPal; // number of features registered in PAL, when using limitNumLabels
//! Property definitions
static QgsPropertiesDefinition PROPERTY_DEFINITIONS;
private:
/**
@ -645,6 +649,10 @@ class CORE_EXPORT QgsPalLayerSettings
static const QVector< PredefinedPointPosition > DEFAULT_PLACEMENT_ORDER;
static void initPropertyDefinitions();
//! Property definitions
static QgsPropertiesDefinition sPropertyDefinitions;
};
/** \ingroup core

View File

@ -31,14 +31,14 @@
#include <QPointF>
#include <QPolygonF>
QgsPropertiesDefinition QgsSymbolLayer::PROPERTY_DEFINITIONS;
QgsPropertiesDefinition QgsSymbolLayer::sPropertyDefinitions;
void QgsSymbolLayer::initPropertyDefinitions()
{
if ( !PROPERTY_DEFINITIONS.isEmpty() )
if ( !sPropertyDefinitions.isEmpty() )
return;
PROPERTY_DEFINITIONS = QgsPropertiesDefinition
sPropertyDefinitions = QgsPropertiesDefinition
{
{ QgsSymbolLayer::PropertySize, QgsPropertyDefinition( "size", QObject::tr( "Symbol size" ), QgsPropertyDefinition::Size ) },
{ QgsSymbolLayer::PropertyAngle, QgsPropertyDefinition( "angle", QObject::tr( "Rotation angle" ), QgsPropertyDefinition::Double ) },
@ -189,6 +189,12 @@ void QgsSymbolLayer::prepareExpressions( const QgsSymbolRenderContext& context )
}
}
const QgsPropertiesDefinition&QgsSymbolLayer::propertyDefinitions()
{
QgsSymbolLayer::initPropertyDefinitions();
return sPropertyDefinitions;
}
QgsSymbolLayer::~QgsSymbolLayer()
{
delete mPaintEffect;

View File

@ -109,8 +109,11 @@ class CORE_EXPORT QgsSymbolLayer
PropertyArrowType, //!< Arrow type
};
//! Property definitions
static QgsPropertiesDefinition PROPERTY_DEFINITIONS;
/**
* Returns the symbol layer property definitions.
* @note added in QGIS 3.0
*/
static const QgsPropertiesDefinition& propertyDefinitions();
virtual ~QgsSymbolLayer();
@ -309,6 +312,7 @@ class CORE_EXPORT QgsSymbolLayer
void setDataDefinedProperties( const QgsPropertyCollection& collection ) { mDataDefinedProperties = collection; }
protected:
QgsSymbolLayer( QgsSymbol::SymbolType type, bool locked = false );
QgsSymbol::SymbolType mType;
@ -351,6 +355,10 @@ class CORE_EXPORT QgsSymbolLayer
private:
static void initPropertyDefinitions();
//! Property definitions
static QgsPropertiesDefinition sPropertyDefinitions;
};
//////////////////////

View File

@ -906,7 +906,7 @@ QgsSymbolLayer* QgsSymbolLayerUtils::loadSymbolLayer( QDomElement& element )
QDomElement ddProps = element.firstChildElement( QStringLiteral( "data_defined_properties" ) );
if ( !ddProps.isNull() )
{
layer->dataDefinedProperties().readXml( ddProps, element.ownerDocument(), QgsSymbolLayer::PROPERTY_DEFINITIONS );
layer->dataDefinedProperties().readXml( ddProps, element.ownerDocument(), QgsSymbolLayer::propertyDefinitions() );
}
return layer;
@ -957,7 +957,7 @@ QDomElement QgsSymbolLayerUtils::saveSymbol( const QString& name, QgsSymbol* sym
layer->paintEffect()->saveProperties( doc, layerEl );
QDomElement ddProps = doc.createElement( QStringLiteral( "data_defined_properties" ) );
layer->dataDefinedProperties().writeXml( ddProps, doc, QgsSymbolLayer::PROPERTY_DEFINITIONS );
layer->dataDefinedProperties().writeXml( ddProps, doc, QgsSymbolLayer::propertyDefinitions() );
layerEl.appendChild( ddProps );
if ( layer->subSymbol() )

View File

@ -261,7 +261,7 @@ QgsExpressionContext QgsLayerPropertiesWidget::createExpressionContext() const
void QgsLayerPropertiesWidget::registerDataDefinedButton( QgsPropertyOverrideButton* button, QgsSymbolLayer::Property key )
{
button->init( key, mLayer->dataDefinedProperties(), QgsSymbolLayer::PROPERTY_DEFINITIONS, mVectorLayer );
button->init( key, mLayer->dataDefinedProperties(), QgsSymbolLayer::propertyDefinitions(), mVectorLayer );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsLayerPropertiesWidget::updateProperty );
button->registerExpressionContextGenerator( this );
}

View File

@ -339,7 +339,7 @@ void QgsDataDefinedValueDialog::init( int propertyKey )
{
QgsProperty dd( symbolDataDefined() );
mDDBtn->init( propertyKey, dd, QgsSymbolLayer::PROPERTY_DEFINITIONS, mLayer );
mDDBtn->init( propertyKey, dd, QgsSymbolLayer::propertyDefinitions(), mLayer );
mDDBtn->registerExpressionContextGenerator( this );
QgsSymbol* initialSymbol = nullptr;

View File

@ -111,7 +111,7 @@ QgsSymbolWidgetContext QgsSymbolLayerWidget::context() const
void QgsSymbolLayerWidget::registerDataDefinedButton( QgsPropertyOverrideButton * button, QgsSymbolLayer::Property key )
{
button->init( key, symbolLayer()->dataDefinedProperties(), QgsSymbolLayer::PROPERTY_DEFINITIONS, mVectorLayer );
button->init( key, symbolLayer()->dataDefinedProperties(), QgsSymbolLayer::propertyDefinitions(), mVectorLayer );
connect( button, &QgsPropertyOverrideButton::changed, this, &QgsSymbolLayerWidget::updateDataDefinedProperty );
button->registerExpressionContextGenerator( this );

View File

@ -515,10 +515,10 @@ void QgsSymbolsListWidget::updateSymbolInfo()
if ( mLayer )
{
QgsProperty ddSize( markerSymbol->dataDefinedSize() );
mSizeDDBtn->init( QgsSymbolLayer::PropertySize, ddSize, QgsSymbolLayer::PROPERTY_DEFINITIONS, mLayer );
mSizeDDBtn->init( QgsSymbolLayer::PropertySize, ddSize, QgsSymbolLayer::propertyDefinitions(), mLayer );
spinSize->setEnabled( !mSizeDDBtn->isActive() );
QgsProperty ddAngle( markerSymbol->dataDefinedAngle() );
mRotationDDBtn->init( QgsSymbolLayer::PropertyAngle, ddAngle, QgsSymbolLayer::PROPERTY_DEFINITIONS, mLayer );
mRotationDDBtn->init( QgsSymbolLayer::PropertyAngle, ddAngle, QgsSymbolLayer::propertyDefinitions(), mLayer );
spinAngle->setEnabled( !mRotationDDBtn->isActive() );
}
else
@ -535,7 +535,7 @@ void QgsSymbolsListWidget::updateSymbolInfo()
if ( mLayer )
{
QgsProperty dd( lineSymbol->dataDefinedWidth() );
mWidthDDBtn->init( QgsSymbolLayer::PropertyOutlineWidth, dd, QgsSymbolLayer::PROPERTY_DEFINITIONS, mLayer );
mWidthDDBtn->init( QgsSymbolLayer::PropertyOutlineWidth, dd, QgsSymbolLayer::propertyDefinitions(), mLayer );
spinWidth->setEnabled( !mWidthDDBtn->isActive() );
}
else