Skip to content
Permalink
Browse files
Merge pull request #2857 from nyalldawson/properties2
Properties framework
  • Loading branch information
nyalldawson committed Jan 23, 2017
2 parents 5753576 + 69d10fa commit ea116fd8933b4e9e486c616f57c7439e27bf9593
Show file tree
Hide file tree
Showing 243 changed files with 10,240 additions and 5,310 deletions.
@@ -596,6 +596,13 @@ QgsComposerNodesItem {#qgis_api_break_3_0_QgsComposerNodesItem}
- _writeXMLStyle() has been renamed to _writeXMLStyle()
- unselectNode() has been renamed to deselectNode() <!--#spellok-->

QgsComposerObject {#qgis_api_break_3_0_QgsComposerObject}
-----------------

- dataDefinedProperty() and setDataDefinedProperty() no longer use QgsDataDefined objects.
Instead these methods have been ported to the QgsProperty framework.
- dataDefinedEvaluate() was removed. Use the QgsProperty evaluation methods instead.


QgsComposerPicture {#qgis_api_break_3_0_QgsComposerPicture}
------------------
@@ -610,6 +617,13 @@ QgsComposerObject::dataDefinedProperty instead.
QgsComposerObject::setDataDefinedProperty() instead.
- updatePictureExpression() was removed.

QgsComposerScaleBar {#qgis_api_break_3_0_QgsComposerScaleBar}
-------------------

- setBrush() was removed. Use setFillColor() instead.
- setBrush2() was removed. Use setFillColor2() instead.
- setPen() was removed. Use setLineColor() and setLineWidth() instead.


QgsComposerTable {#qgis_api_break_3_0_QgsComposerTable}
----------------
@@ -633,6 +647,16 @@ QgsComposerTableV2 {#qgis_api_break_3_0_QgsComposerTableV2}
- unselectNode() has been renamed to deselectNode() <!--#spellok-->


QgsComposerUtils {#qgis_api_break_3_0_QgsComposerUtils}
-----------------

- readDataDefinedPropertyMap() was renamed to readOldDataDefinedPropertyMap() and the signature has changed
to use a QgsPropertyCollection object.
- readDataDefinedProperty() was renamed to readOldDataDefinedProperty() and the signature has changed
to use the QgsProperty framework objects.
- writeDataDefinedPropertyMap() was removed. This is now handled by QgsPropertyCollection::writeXml()


QgsComposition {#qgis_api_break_3_0_QgsComposition}
--------------

@@ -648,6 +672,8 @@ were removed. Use setSnapTolerance() and snapTolerance() instead.
- addComposerTable(), composerTableAdded() were removed.
- setAllUnselected() has been renamed to setAllDeselected. <!--#spellok-->
- worldFileMap() and setWorldFileMap() have been renamed to referenceMap() and setReferenceMap()
- dataDefinedProperty() and setDataDefinedProperty() now use the QgsProperty framework instead
of QgsDataDefined objects.


QgsCoordinateReferenceSystem {#qgis_api_break_3_0_QgsCoordinateReferenceSystem}
@@ -751,14 +777,19 @@ QgsDataDefinedButton {#qgis_api_break_3_0_QgsDataDefinedButton}
- registerGetExpressionContextCallback has been removed in favor of registerExpressionContextGenerator



QgsDataDefinedSymbolDialog {#qgis_api_break_3_0_QgsDataDefinedSymbolDialog}
--------------------------

- QgsDataDefinedSymbolDialog was removed. Code using this dialog should be reworked to use QgsDataDefinedButton
instead.


QgsDataDefinedValueDialog {#qgis_api_break_3_0_QgsDataDefinedValueDialog}
--------------------------

- These classes and subclasses now use QgsProperty objects instead of QgsDataDefined.


QgsDataItem {#qgis_api_break_3_0_QgsDataItem}
-----------

@@ -813,6 +844,7 @@ QgsDiagramRenderer {#qgis_api_break_3_0_QgsDiagramRenderer}
------------------
- xform, fields were no longer required and are removed.
- referencedFields() no longer takes a QgsFields argument.
- renderDiagram() now takes an optional data defined overrides collection argument.


QgsDiagramLayerSettings {#qgis_api_break_3_0_QgsDiagramLayerSettings}
@@ -832,6 +864,18 @@ place of a null pointer.
- The dist member variable was removed. setDistance() and distance() should be used instead.
- The renderer member variable was removed, and getRenderer() was renamed to renderer()
- The showAll member variable was removed. setShowAllDiagrams() and showAllDiagrams() should be used instead.
- The xPosColumn, yPosColumn and showColumn attributes were removed. Use setDataDefinedProperties() for
setting data defined properties instead.
- The LinePlacementFlags enum was renamed to LinePlacementFlag
- The placement member variable was removed, and getPlacement() was renamed to placement()
- The placementFlags member variable was removed
- The priority member variable was removed, and getPriority() was renamed to priority()
- The zIndex member variable was removed, and getZIndex() was renamed to zIndex()
- The obstacle member variable was removed. setIsObstacle() and isObstacle() should be used instead.
- The dist member variable was removed. setDistance() and distance() should be used instead.
- The renderer member variable was removed, and getRenderer() was renamed to renderer()
- The showAll member variable was removed. setShowAllDiagrams() and showAllDiagrams() should be used instead.
- referencedFields() no longer requires a QgsFields argument.

QgsDiagramSettings {#qgis_api_break_3_0_QgsDiagramSettings}
------------------
@@ -957,6 +1001,8 @@ QgsFeatureRendererV2 {#qgis_api_break_3_0_QgsFeatureRendererV2}
- symbolsForFeature( QgsFeature& feat ) has been removed. The symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as symbolsForFeature2 in PyQGIS bindings).
- originalSymbolsForFeature( QgsFeature& feat ) has been removed. The originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) method should be used instead (previously available as originalSymbolsForFeature2 in PyQGIS bindings).
- copyPaintEffect() was removed. copyRendererData() should be used instead.
- usedAttributes() now requires a QgsRenderContext argument.


QgsFeatureRequest {#qgis_api_break_3_0_QgsFeatureRequest}
-----------------
@@ -1406,6 +1452,13 @@ QgsPalLayerSettings {#qgis_api_break_3_0_QgsPalLayerSettings}
- ct is now a QgsCoordinateTransform object, not a pointer. An invalid QgsCoordinateTransform will
be used instead of a null pointer if no transformation is required.
- prepareGeometry() and geometryRequiresPreparation() now take a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.
- The DataDefinedProperties enum was renamed to Property
- dataDefinedProperty(), setDataDefinedProperty(), removeDataDefinedProperty(),
removeAllDataDefinedProperties(), updateDataDefinedString(), dataDefinedMap(),
dataDefinedValue(), dataDefinedEvaluate(), dataDefinedIsActive(),
dataDefinedUseExpression(), dataDefinedProperties() and dataDefinedNames()
members were removed. Use the QgsProperty framework through dataDefinedProperties()
and setDataDefinedProperties() instead.


QgsPanelWidgetStack {#qgis_api_break_3_0_QgsPanelWidgetStack}
@@ -1678,17 +1731,26 @@ parameters or QgsSymbol::OutputUnitList parameters now take QgsUnitTypes::Render
data defined rotation.
- setRenderHints() and renderHints() now accept and return a QgsSymbol::RenderHints flag rather
than an integer value
- usedAttributes() now requires a QgsRenderContext argument.
- setDataDefinedAngle(), dataDefinedAngle(), setDataDefinedSize(), dataDefinedSize(), setDataDefinedWidth() and dataDefinedWidth()
now work with QgsProperty objects instead of QgsDataDefined.


QgsSymbolLayer (renamed from QgsSymbolLayerV2) {#qgis_api_break_3_0_QgsSymbolLayer}
----------------------------------------------

- The deprecated prepareExpressions( const QgsFields* fields, double scale = -1.0 ) method has been removed. Use
the variant which takes QgsSymbolRenderContext instead.
- The deprecated methods dataDefinedProperty( const QString& property ) and dataDefinedPropertyString() were removed. Use getDataDefinedProperty() instead.
- setDataDefinedProperty( const QString& property, const QString& expressionString ) was removed. Use setDataDefinedProperty( const QString& property, QgsDataDefined* dataDefined ) instead.
- evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature ) was removed. Use the variant which takes QgsSymbolRenderContext instead.
- expression() was removed. Use getDataDefinedProperty or evaluateDataDefinedProperty instead.
- The deprecated methods dataDefinedProperty( const QString& property ) and dataDefinedPropertyString() were removed. Use dataDefinedProperties() instead.
- setDataDefinedProperty now requires a QgsSymbolLayer.Property argument instead of the string based key.
- removeDataDefinedProperty(), removeDataDefinedProperties(), hasDataDefinedProperties(), hasDataDefinedProperty(), evaluateDataDefinedProperty()
were removed. Use the QgsProperty/QgsPropertyCollection methods instead.
- getDataDefinedProperty() was removed. Use dataDefinedProperties() instead.
- expression() was removed.
- usedAttributes() now requires a QgsRenderContext argument
- saveDataDefinedProperties() was removed. This is no longer required.
- restoreDataDefinedProperties() was renamed to restoreOldDataDefinedProperties()


QgsSymbolLayerRegistry {#qgis_api_break_3_0_QgsSymbolLayerRegistry}
----------------------
@@ -1729,6 +1791,7 @@ QgsSymbolSelectorWidget {#qgis_api_break_3_0_QgsSymbolSelectorWidget}
-----------------------

- saveSymbol() was removed.
- registerDataDefinedButton now works with QgsPropertyOverrideButton and QgsProperty keys


QgsSymbolSelectorDialog {#qgis_api_break_3_0_QgsSymbolSelectorDialog}
@@ -242,9 +242,13 @@ class QgsComposerLegend : QgsComposerItem
//Overridden to show legend title
virtual QString displayName() const;

const QgsLegendSettings& legendSettings() const;

public slots:
/** Data changed*/
void synchronizeWithModel();
/** Sets mCompositionMap to 0 if the map is deleted*/
void invalidateCurrentMap();
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext* context = nullptr );

};
@@ -32,6 +32,8 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
Transparency, /*!< item transparency */
BlendMode, /*!< item blend mode */
ExcludeFromExports, /*!< exclude item from exports */
FrameColor, //!< Item frame color
BackgroundColor, //!< Item background color
//composer map
MapRotation, /*!< map rotation */
MapScale, /*!< map scale */
@@ -44,10 +46,22 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
MapStylePreset, /*!< layer and style visibility preset */
//composer picture
PictureSource, /*!< picture source url */
PictureSvgBackgroundColor, //!< SVG background color
PictureSvgOutlineColor, //!< SVG outline color
PictureSvgOutlineWidth, //!< SVG outline width
//html item
SourceUrl /*!< html source url */
//legend item
LegendTitle, //!< Legend title
LegendColumnCount, //!< Legend column count
ScalebarFillColor, //!< Scalebar fill color
ScalebarFillColor2, //!< Scalebar secondary fill color
ScalebarLineColor, //!< Scalebar line color
ScalebarLineWidth, //!< Scalebar line width
};

static const 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.
@@ -84,21 +98,24 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
*/
virtual bool readXml( const QDomElement& itemElem, const QDomDocument& doc );

/** Returns a reference to the data defined settings for one of the item's data defined properties.
* @param property data defined property to return
* @note this method was added in version 2.5
/** Returns a reference to the object's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
QgsDataDefined* dataDefinedProperty( const DataDefinedProperty property ) const;
QgsPropertyCollection& dataDefinedProperties();

/** Sets parameters for a data defined property for the item
* @param property data defined property to set
* @param active true if data defined property is active, false if it is disabled
* @param useExpression true if the expression should be used
* @param expression expression for data defined property
* @param field field name if the data defined property should take its value from a field
* @note this method was added in version 2.5
/** Returns a reference to the object's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
//const QgsPropertyCollection& dataDefinedProperties() const;

/** Sets the objects's property collection, used for data defined overrides.
* @param collection property collection. Existing properties will be replaced.
* @note added in QGIS 3.0
* @see dataDefinedProperties()
*/
void setDataDefinedProperty( const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field );
void setDataDefinedProperties( const QgsPropertyCollection& collection );

/** Set a custom property for the object.
* @param key property key. If a property with the same key already exists it will be overwritten.
@@ -159,18 +176,6 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
*/
virtual void refreshDataDefinedProperty( const DataDefinedProperty property = AllProperties, const QgsExpressionContext* context = 0 );

protected:

/** Evaluate a data defined property and return the calculated value
* @returns true if data defined property could be successfully evaluated
* @param property data defined property to evaluate
* @param expressionValue QVariant for storing the evaluated value
* @param context expression context for evaluating expressions. Must have feature and fields set to current
* atlas feature and coverage layer fields prior to calling this method.
* @note this method was added in version 2.5
*/
bool dataDefinedEvaluate( const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext& context = QgsExpressionContext() ) const;

signals:
/** Emitted when the item changes. Signifies that the item widgets must update the
* gui elements.
@@ -134,20 +134,65 @@ class QgsComposerScaleBar: QgsComposerItem
*/
void setFontColor( const QColor& c );

/** Returns the color used for fills in the scalebar.
* @see setFillColor()
* @see fillColor2()
* @note added in QGIS 3.0
*/
QColor fillColor() const;

/** Sets the color used for fills in the scalebar.
* @see fillColor()
* @see setFillColor2()
* @note added in QGIS 3.0
*/
void setFillColor( const QColor& color );

/** Returns the secondary color used for fills in the scalebar.
* @see setFillColor2()
* @see fillColor()
* @note added in QGIS 3.0
*/
QColor fillColor2() const;

/** Sets the secondary color used for fills in the scalebar.
* @see fillColor2()
* @see setFillColor2()
* @note added in QGIS 3.0
*/
void setFillColor2( const QColor& color );

/** Returns the color used for lines in the scalebar.
* @see setLineColor()
* @note added in QGIS 3.0
*/
QColor lineColor() const;

/** Sets the color used for lines in the scalebar.
* @see lineColor()
* @note added in QGIS 3.0
*/
void setLineColor( const QColor& color );

/** Returns the line width in millimeters for lines in the scalebar.
* @see setLineWidth()
* @note added in QGIS 3.0
*/
double lineWidth() const;

/** Sets the line width in millimeters for lines in the scalebar.
* @see lineWidth()
* @note added in QGIS 3.0
*/
void setLineWidth( double width );

/** Returns the pen used for drawing the scalebar.
* @returns QPen used for drawing the scalebar outlines.
* @see setPen
* @see brush
*/