From 9cc9d424ce0e6c1a258f5bc8d773dfb9f203cacc Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 7 Dec 2015 21:54:40 +1100 Subject: [PATCH] Add extra check for deprecations to documentation test This check tests that if a function has been declared deprecated with either Q_DECL_DEPRECATED or has a @deprecated Doxygen note then it MUST have both the Q_DECL_DEPRECATD and @deprecated note. It's important that both are used, as Q_DECL_DEPRECATED allows throwing a warning if that method is used in code, while the @deprecated doxygen note gives an indication to devs/PyQGIS users of why it's deprecated and what should be used instead. Ideally we'd also test for SIP /Deprecated/ tags, but I can't find any reliable way to do this. --- python/core/composer/qgsatlascomposition.sip | 6 +++- python/core/composer/qgscomposeritem.sip | 4 ++- python/core/composer/qgscomposerlegend.sip | 2 +- python/core/composer/qgscomposermap.sip | 1 + python/core/composer/qgscomposertablev2.sip | 5 ++++ python/core/composer/qgscomposition.sip | 1 + python/core/diagram/qgsdiagram.sip | 2 ++ python/core/qgscachedfeatureiterator.sip | 2 +- python/core/qgsdatadefined.sip | 4 +++ python/core/qgsdataitem.sip | 2 +- python/core/qgsexpression.sip | 12 ++++++++ python/core/qgsfeature.sip | 3 +- python/core/qgsowsconnection.sip | 1 + python/core/qgssnapper.sip | 2 +- python/core/qgsvectorlayer.sip | 10 ++++--- python/core/raster/qgsrasterlayer.sip | 6 ++-- python/core/symbology-ng/qgsrendererv2.sip | 30 ++++++++++++------- .../symbology-ng/qgsrulebasedrendererv2.sip | 6 ++-- python/core/symbology-ng/qgssymbollayerv2.sip | 2 ++ python/gui/qgsmapcanvas.sip | 2 +- python/gui/qgsrubberband.sip | 2 +- .../qgsdatadefinedsymboldialog.sip | 15 ++++++++++ src/app/gps/qgsgpsinformationwidget.cpp | 16 +++++++--- src/app/qgsattributetabledialog.cpp | 2 +- src/app/qgsmergeattributesdialog.cpp | 2 +- src/core/composer/qgsatlascomposition.h | 6 +++- src/core/composer/qgscomposeritem.h | 4 ++- src/core/composer/qgscomposerlegend.h | 2 +- src/core/composer/qgscomposermap.h | 1 + src/core/composer/qgscomposertablev2.h | 5 ++++ src/core/composer/qgscomposition.h | 1 + src/core/diagram/qgsdiagram.h | 1 + src/core/qgis.h | 2 +- src/core/qgscachedfeatureiterator.h | 2 +- src/core/qgsdatadefined.h | 4 +++ src/core/qgsdataitem.h | 2 +- src/core/qgsexpression.h | 14 +++++++++ src/core/qgsfeature.h | 4 +-- src/core/qgsgml.cpp | 4 ++- src/core/qgslegacyhelpers.h | 3 ++ src/core/qgsmaplayer.h | 2 +- src/core/qgsowsconnection.h | 1 + src/core/qgssnapper.h | 2 +- src/core/qgsvectorlayer.h | 6 ++-- src/core/raster/qgsrasterlayer.h | 4 +-- src/core/symbology-ng/qgsrendererv2.h | 30 ++++++++++++------- .../symbology-ng/qgsrulebasedrendererv2.cpp | 6 ++-- .../symbology-ng/qgsrulebasedrendererv2.h | 7 +++-- src/core/symbology-ng/qgssymbollayerv2.h | 2 ++ src/gui/qgsattributedialog.h | 2 +- src/gui/qgsmapcanvas.h | 2 +- src/gui/qgsmaptoolcapture.cpp | 4 +-- src/gui/qgsrubberband.h | 4 +-- .../symbology-ng/qgsdatadefinedsymboldialog.h | 17 +++++++++++ src/gui/symbology-ng/qgsrendererv2widget.h | 1 + .../qgsrulebasedrendererv2widget.cpp | 2 +- src/plugins/topology/checkDock.cpp | 2 +- .../mssql/qgsmssqlfeatureiterator.cpp | 4 ++- src/providers/ogr/qgsogrfeatureiterator.cpp | 11 ++++++- .../postgres/qgspostgresfeatureiterator.cpp | 6 ++-- .../qgsspatialitefeatureiterator.cpp | 13 +++++--- src/providers/wfs/qgswfsfeatureiterator.cpp | 5 +++- src/providers/wms/qgswmsprovider.cpp | 4 ++- tests/src/core/testqgsfeature.cpp | 2 +- tests/src/gui/testqgsrubberband.cpp | 2 +- tests/src/python/utilities.py | 24 +++++++++++++-- 66 files changed, 275 insertions(+), 85 deletions(-) diff --git a/python/core/composer/qgsatlascomposition.sip b/python/core/composer/qgsatlascomposition.sip index 7baf72fcd885..aeb30b875109 100644 --- a/python/core/composer/qgsatlascomposition.sip +++ b/python/core/composer/qgsatlascomposition.sip @@ -254,10 +254,14 @@ public: */ void setMargin( float margin ) /Deprecated/; + //! @deprecated use sortKeyAttributeName instead int sortKeyAttributeIndex() const /Deprecated/; + //! @deprecated use setSortKeyAttributeName instead void setSortKeyAttributeIndex( int idx ) /Deprecated/; - /** Returns the current atlas feature. Must be called after prepareForFeature(). */ + /** Returns the current atlas feature. Must be called after prepareForFeature( i ). + * @deprecated use feature() instead + */ QgsFeature* currentFeature() /Deprecated/; /** Returns the current atlas geometry in the given projection system (default to the coverage layer's CRS) */ diff --git a/python/core/composer/qgscomposeritem.sip b/python/core/composer/qgscomposeritem.sip index 7aa7a4886a7d..e1e048cba058 100644 --- a/python/core/composer/qgscomposeritem.sip +++ b/python/core/composer/qgscomposeritem.sip @@ -688,7 +688,9 @@ class QgsComposerItem : QgsComposerObject, QGraphicsRectItem */ void drawArrowHead( QPainter* p, double x, double y, double angle, double arrowHeadWidth ) const /Deprecated/; - /** Returns angle of the line from p1 to p2 (clockwise, starting at N)*/ + /** Returns angle of the line from p1 to p2 (clockwise, starting at N) + * @deprecated will be removed in QGIS 3.0 + */ double angle( const QPointF& p1, const QPointF& p2 ) const /Deprecated/; /** Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the diff --git a/python/core/composer/qgscomposerlegend.sip b/python/core/composer/qgscomposerlegend.sip index 35c3b32dba77..1d6aafe580ef 100644 --- a/python/core/composer/qgscomposerlegend.sip +++ b/python/core/composer/qgscomposerlegend.sip @@ -47,7 +47,7 @@ class QgsComposerLegend : QgsComposerItem void adjustBoxSize(); /** Returns pointer to the legend model*/ - //! @note deprecated in 2.6 - use modelV2() + //! @deprecated in 2.6 - use modelV2() QgsLegendModel* model() /Deprecated/; //! @note added in 2.6 diff --git a/python/core/composer/qgscomposermap.sip b/python/core/composer/qgscomposermap.sip index c471917b7bfa..9e3d45765ef3 100644 --- a/python/core/composer/qgscomposermap.sip +++ b/python/core/composer/qgscomposermap.sip @@ -740,6 +740,7 @@ class QgsComposerMap : QgsComposerItem /** Transforms map coordinates to item coordinates (considering rotation and move offset)*/ QPointF mapToItemCoords( const QPointF& mapCoords ) const; + //! @deprecated will be removed in QGIS 3.0 void connectMapOverviewSignals() /Deprecated/; /** Calculates the extent to request and the yShift of the top-left point in case of rotation. diff --git a/python/core/composer/qgscomposertablev2.sip b/python/core/composer/qgscomposertablev2.sip index cd2b9222172b..6840aef21c7b 100644 --- a/python/core/composer/qgscomposertablev2.sip +++ b/python/core/composer/qgscomposertablev2.sip @@ -509,6 +509,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame /** Calculates how many content rows are visible within a given frame * @param frameIndex index number for frame * @returns number of visible content rows (excludes header rows) + * @deprecated will be removed in QGIS 3.0 */ int rowsVisible( const int frameIndex ) const /Deprecated/; @@ -517,6 +518,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame * @param frameHeight height of frame * @param includeHeader set to true if frame would include a header row * @returns number of visible content rows (excluding header row) + * @deprecated will be removed in QGIS 3.0 */ int rowsVisible( const double frameHeight, const bool includeHeader ) const /Deprecated/; @@ -525,6 +527,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame * @param extent visible extent * @param frameIndex index number for frame * @returns row range + * @deprecated will be removed in QGIS 3.0 */ QPair rowRange( const QRectF &extent, const int frameIndex ) const /Deprecated/; @@ -533,6 +536,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame * @param rows number of rows shown in table * @param drawHeaderLines set to true to include for the table header * @see drawVerticalGridLines + * @deprecated will be removed in QGIS 3.0 */ void drawHorizontalGridLines( QPainter* painter, const int rows, const bool drawHeaderLines ) const /Deprecated/; @@ -547,6 +551,7 @@ class QgsComposerTableV2: QgsComposerMultiFrame * @see drawVerticalGridLines * @see calculateMaxColumnWidths * @note not available in python bindings + * @deprecated will be removed in QGIS 3.0 */ // void drawVerticalGridLines( QPainter* painter, const QMap& maxWidthMap, const int numberRows, const bool hasHeader, const bool mergeCells = false ) const /Deprecated/; diff --git a/python/core/composer/qgscomposition.sip b/python/core/composer/qgscomposition.sip index 8910c367eaf7..83a36f6be910 100644 --- a/python/core/composer/qgscomposition.sip +++ b/python/core/composer/qgscomposition.sip @@ -355,6 +355,7 @@ class QgsComposition : QGraphicsScene composer user interface item properties). @param item the item. @return QgsComposerHtml pointer or 0 pointer if no such item exists. + @deprecated Use QgsComposerFrame::multiFrame() instead */ const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) const /Deprecated/; diff --git a/python/core/diagram/qgsdiagram.sip b/python/core/diagram/qgsdiagram.sip index 9fbe72ade227..236551ea22d0 100644 --- a/python/core/diagram/qgsdiagram.sip +++ b/python/core/diagram/qgsdiagram.sip @@ -10,6 +10,8 @@ class QgsDiagram virtual QgsDiagram* clone() const = 0 /Factory/; void clearCache(); + + //! @deprecated use QgsExpressionContext variant instead QgsExpression* getExpression( const QString& expression, const QgsFields* fields ) /Deprecated/; /** Returns a prepared expression for the specified context. diff --git a/python/core/qgscachedfeatureiterator.sip b/python/core/qgscachedfeatureiterator.sip index be25c74abe30..147272dc84c9 100644 --- a/python/core/qgscachedfeatureiterator.sip +++ b/python/core/qgscachedfeatureiterator.sip @@ -15,7 +15,7 @@ class QgsCachedFeatureIterator : QgsAbstractFeatureIterator * @deprecated Use QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest ) * instead */ - QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, const QgsFeatureRequest& featureRequest, const QgsFeatureIds& featureIds ); + QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, const QgsFeatureRequest& featureRequest, const QgsFeatureIds& featureIds ) /Deprecated/; /** * This constructor creates a feature iterator, that delivers all cached features. No request is made to the backend. diff --git a/python/core/qgsdatadefined.sip b/python/core/qgsdatadefined.sip index c0d540e769f0..6466ceb80453 100644 --- a/python/core/qgsdatadefined.sip +++ b/python/core/qgsdatadefined.sip @@ -119,6 +119,7 @@ class QgsDataDefined /** Prepares the expression using a vector layer * @param layer vector layer * @returns true if expression was successfully prepared + * @deprecated use QgsExpressionContext variant instead */ bool prepareExpression( QgsVectorLayer* layer ) /Deprecated/; @@ -126,6 +127,7 @@ class QgsDataDefined * @param fields * @returns true if expression was successfully prepared * @note added in QGIS 2.9 + * @deprecated use QgsExpressionContext variant instead */ bool prepareExpression( const QgsFields &fields ) /Deprecated/; @@ -145,12 +147,14 @@ class QgsDataDefined /** Returns the columns referenced by the QgsDataDefined * @param layer vector layer, used for preparing the expression if required + * @deprecated use QgsExpressionContext variant instead */ QStringList referencedColumns( QgsVectorLayer* layer ) /Deprecated/; /** Returns the columns referenced by the QgsDataDefined * @param fields vector layer, used for preparing the expression if required * @note added in QGIS 2.9 + * @deprecated use QgsExpressionContext variant instead */ QStringList referencedColumns( const QgsFields& fields ) /Deprecated/; diff --git a/python/core/qgsdataitem.sip b/python/core/qgsdataitem.sip index 22b88fb36217..0b3dc0ced502 100644 --- a/python/core/qgsdataitem.sip +++ b/python/core/qgsdataitem.sip @@ -89,7 +89,7 @@ class QgsDataItem : QObject virtual void setState( State state ); //! @deprecated in 2.8, use state() - bool isPopulated(); + bool isPopulated() /Deprecated/; // Insert new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals // refresh - refresh populated item, emit signals to model diff --git a/python/core/qgsexpression.sip b/python/core/qgsexpression.sip index 242d54f81553..48e39c05d050 100644 --- a/python/core/qgsexpression.sip +++ b/python/core/qgsexpression.sip @@ -17,6 +17,7 @@ class QgsExpression const QgsExpression::Node* rootNode() const; //! Get the expression ready for evaluation - find out column indexes. + //! @deprecated use prepare( const QgsExpressionContext *context ) instead bool prepare( const QgsFields &fields ) /Deprecated/; /** Get the expression ready for evaluation - find out column indexes. @@ -40,20 +41,24 @@ class QgsExpression //! Evaluate the feature and return the result //! @note prepare() should be called before calling this method + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead QVariant evaluate( const QgsFeature* f ) /Deprecated/; //! Evaluate the feature and return the result //! @note prepare() should be called before calling this method //! @note available in python bindings as evaluatePrepared + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead QVariant evaluate( const QgsFeature& f ) /PyName=evaluatePrepared,Deprecated/; //! Evaluate the feature and return the result //! @note this method does not expect that prepare() has been called on this instance + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead QVariant evaluate( const QgsFeature* f, const QgsFields& fields ) /Deprecated/; //! Evaluate the feature and return the result //! @note this method does not expect that prepare() has been called on this instance //! @note not available in python bindings + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead // inline QVariant evaluate( const QgsFeature& f, const QgsFields& fields ) { return evaluate( &f, fields ); } /** Evaluate the feature and return the result. @@ -77,8 +82,10 @@ class QgsExpression void setEvalErrorString( const QString& str ); //! Set the number for $rownum special column + //! @deprecated use QgsExpressionContext to set row number instead void setCurrentRowNumber( int rowNumber ) /Deprecated/; //! Return the number used for $rownum special column + //! @deprecated use QgsExpressionContext to retrieve row number instead int currentRowNumber() /Deprecated/; /** Assign a special column @@ -102,6 +109,7 @@ class QgsExpression */ bool isField() const; + //! @deprecated use QgsExpressionContext variant instead static bool isValid( const QString& text, const QgsFields& fields, QString &errorMessage ) /Deprecated/; /** Tests whether a string is a valid expression. @@ -143,6 +151,7 @@ class QgsExpression @param substitutionMap @param distanceArea optional QgsDistanceArea. If specified, the QgsDistanceArea is used for distance and area conversion + @deprecated use QgsExpressionContext variant instead */ static QString replaceExpressionText( const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, @@ -289,6 +298,7 @@ class QgsExpression /** The help text for the function. */ const QString helptext(); + //! @deprecated Use QgsExpressionContext variant instead virtual QVariant func( const QVariantList& values, const QgsFeature* f, QgsExpression* parent ) /Deprecated/; /** Returns result of evaluating the function. @@ -405,6 +415,7 @@ class QgsExpression virtual QgsExpression::NodeType nodeType() const = 0; // abstract virtual eval function // errors are reported to the parent + //! @deprecated Use QgsExpressionContext variant instead virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ) /Deprecated/; /** Evaluation function for nodes. Errors are reported to the parent. @@ -414,6 +425,7 @@ class QgsExpression // abstract virtual preparation function // errors are reported to the parent + //! @deprecated Use QgsExpressionContext variant instead virtual bool prepare( QgsExpression* parent, const QgsFields &fields ) /Deprecated/; /** Preparation function for nodes. Errors are reported to the parent. diff --git a/python/core/qgsfeature.sip b/python/core/qgsfeature.sip index 59663c78d0d7..7db98295d222 100644 --- a/python/core/qgsfeature.sip +++ b/python/core/qgsfeature.sip @@ -356,6 +356,7 @@ class QgsFeature * @returns pointer to feature's geometry * @see geometry * @see setGeometry + * @deprecated use constGeometry() instead */ QgsGeometry *geometryAndOwnership() /Factory,Deprecated/; @@ -391,7 +392,7 @@ class QgsFeature * @see geometryAndOwnership * @deprecated will be removed in QGIS 3.0 */ - void setGeometryAndOwnership( unsigned char * geom /Transfer/, size_t length ); + void setGeometryAndOwnership( unsigned char * geom /Transfer/, size_t length ) /Deprecated/; /** Assign a field map with the feature to allow attribute access by attribute name. * @param fields The attribute fields which this feature holds diff --git a/python/core/qgsowsconnection.sip b/python/core/qgsowsconnection.sip index ecdef2747b94..6f86c05eb4aa 100644 --- a/python/core/qgsowsconnection.sip +++ b/python/core/qgsowsconnection.sip @@ -26,5 +26,6 @@ class QgsOWSConnection : QObject QgsDataSourceURI uri(); QString mConnectionInfo; + //! @deprecated use mConnectionInfo instead QString connectionInfo() /Deprecated/; }; diff --git a/python/core/qgssnapper.sip b/python/core/qgssnapper.sip index 634715074aff..d2ca711f81ae 100644 --- a/python/core/qgssnapper.sip +++ b/python/core/qgssnapper.sip @@ -69,7 +69,7 @@ class QgsSnapper QgsTolerance::UnitType mUnitType; }; - //!@ deprecated since 2.4 - use constructor with QgsMapSettings + //!@deprecated since 2.4 - use constructor with QgsMapSettings QgsSnapper( QgsMapRenderer *mapRender ) /Deprecated/; explicit QgsSnapper( const QgsMapSettings& mapSettings ); diff --git a/python/core/qgsvectorlayer.sip b/python/core/qgsvectorlayer.sip index 16ce853d3af2..1c59240ff249 100644 --- a/python/core/qgsvectorlayer.sip +++ b/python/core/qgsvectorlayer.sip @@ -324,8 +324,10 @@ class QgsVectorLayer : QgsMapLayer struct RangeData { - RangeData(); - RangeData( const QVariant& theMin, const QVariant& theMax, const QVariant& theStep ); + //! @deprecated Use the editorWidgetV2() system instead + RangeData() /Deprecated/; + //! @deprecated Use the editorWidgetV2() system instead + RangeData( const QVariant& theMin, const QVariant& theMax, const QVariant& theStep ) /Deprecated/; QVariant mMin; QVariant mMax; @@ -678,7 +680,7 @@ class QgsVectorLayer : QgsMapLayer * * @deprecated Will be removed for QGIS 3 in favor of importNamedStyle */ - virtual bool applyNamedStyle( const QString& namedStyle, QString &errorMsg /Out/ ); + virtual bool applyNamedStyle( const QString& namedStyle, QString &errorMsg /Out/ ) /Deprecated/; /** Convert a saved attribute editor element into a AttributeEditor structure as it's used internally. * @param elem the DOM element @@ -946,7 +948,7 @@ class QgsVectorLayer : QgsMapLayer bool draw( QgsRenderContext& rendererContext ); /** Draws the layer labels using the old labeling engine - * @note deprecated + * @deprecated will be removed in QGIS 3.0 */ void drawLabels( QgsRenderContext& rendererContext ) /Deprecated/; diff --git a/python/core/raster/qgsrasterlayer.sip b/python/core/raster/qgsrasterlayer.sip index 5fac331f77ef..0f72932fbb9b 100644 --- a/python/core/raster/qgsrasterlayer.sip +++ b/python/core/raster/qgsrasterlayer.sip @@ -169,7 +169,9 @@ class QgsRasterLayer : QgsMapLayer /** \brief Set default contrast enhancement */ void setDefaultContrastEnhancement(); - /** \brief Overloaded version of the above function for convenience when restoring from xml */ + /** \brief Overloaded version of the above function for convenience when restoring from xml + * @deprecated Deprecated since QGIS 2.10. Use setRendererForDrawingStyle() or directly setRenderer() + */ void setDrawingStyle( const QString & theDrawingStyleQString ) /Deprecated/; /** \brief [ data provider interface ] A wrapper function to emit a progress update signal */ @@ -179,7 +181,7 @@ class QgsRasterLayer : QgsMapLayer virtual QStringList subLayers() const; /** \brief Draws a preview of the rasterlayer into a pixmap - @note - use previewAsImage() for rendering with QGIS>=2.4 */ + @deprecated use previewAsImage() for rendering with QGIS>=2.4 */ QPixmap previewAsPixmap( const QSize& size, const QColor& bgColor = QColor( 255, 255, 255 ) ) /Deprecated/; /** \brief Draws a preview of the rasterlayer into a QImage diff --git a/python/core/symbology-ng/qgsrendererv2.sip b/python/core/symbology-ng/qgsrendererv2.sip index 73b00e5025e8..5f4ccf9b899c 100644 --- a/python/core/symbology-ng/qgsrendererv2.sip +++ b/python/core/symbology-ng/qgsrendererv2.sip @@ -64,6 +64,7 @@ class QgsFeatureRendererV2 /** To be overridden * @param feature feature * @return returns pointer to symbol or 0 if symbol was not found + * @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead */ virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ) /Deprecated/; @@ -83,6 +84,7 @@ class QgsFeatureRendererV2 * symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement * of a symbol for use in rendering. * @note added in 2.6 + * @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead */ virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature ) /Deprecated/; @@ -139,7 +141,9 @@ class QgsFeatureRendererV2 //! returns bitwise OR-ed capabilities of the renderer virtual int capabilities(); - //! for symbol levels + /** For symbol levels + * @deprecated use symbols( QgsRenderContext& context ) instead + */ virtual QgsSymbolV2List symbols() /Deprecated/; /** Returns list of symbols used by the renderer. @@ -217,9 +221,11 @@ class QgsFeatureRendererV2 //! sets rotation field of renderer (if supported by the renderer) virtual void setRotationField( const QString& fieldName ) /Deprecated/; - //! return whether the renderer will render a feature or not. - //! Must be called between startRender() and stopRender() calls. - //! Default implementation uses symbolForFeature(). + /** Returns whether the renderer will render a feature or not. + * Must be called between startRender() and stopRender() calls. + * Default implementation uses symbolForFeature(). + * @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ virtual bool willRenderFeature( QgsFeature& feat ) /Deprecated/; /** Returns whether the renderer will render a feature or not. @@ -231,9 +237,11 @@ class QgsFeatureRendererV2 //TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=willRenderFeature2/; - //! return list of symbols used for rendering the feature. - //! For renderers that do not support MoreSymbolsPerFeature it is more efficient - //! to use symbolForFeature() + /** Returns list of symbols used for rendering the feature. + * For renderers that do not support MoreSymbolsPerFeature it is more efficient + * to use symbolForFeature() + * @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat ) /Deprecated/; /** Returns list of symbols used for rendering the feature. @@ -245,9 +253,11 @@ class QgsFeatureRendererV2 //TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) /PyName=symbolsForFeature2/; - //! Equivalent of originalSymbolsForFeature() call - //! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() - //! @note added in 2.6 + /** Equivalent of originalSymbolsForFeature() call + * extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() + * @note added in 2.6 + * @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat ) /Deprecated/; /** Equivalent of originalSymbolsForFeature() call diff --git a/python/core/symbology-ng/qgsrulebasedrendererv2.sip b/python/core/symbology-ng/qgsrulebasedrendererv2.sip index c9c49461f5f7..ba7db53b0902 100644 --- a/python/core/symbology-ng/qgsrulebasedrendererv2.sip +++ b/python/core/symbology-ng/qgsrulebasedrendererv2.sip @@ -172,7 +172,7 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2 //! @note added in 2.6 //! @deprecated use setActive instead - void setCheckState( bool state ); + void setCheckState( bool state ) /Deprecated/; /** * Sets if this rule is active @@ -188,7 +188,9 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2 QDomElement save( QDomDocument& doc, QgsSymbolV2Map& symbolMap ); - //! prepare the rule for rendering and its children (build active children array) + /** Prepare the rule for rendering and its children (build active children array) + * @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead + */ bool startRender( QgsRenderContext& context, const QgsFields& fields ) /Deprecated/; //! prepare the rule for rendering and its children (build active children array) diff --git a/python/core/symbology-ng/qgssymbollayerv2.sip b/python/core/symbology-ng/qgssymbollayerv2.sip index e97ec64715d8..06c2728736f8 100644 --- a/python/core/symbology-ng/qgssymbollayerv2.sip +++ b/python/core/symbology-ng/qgssymbollayerv2.sip @@ -211,6 +211,7 @@ class QgsSymbolLayerV2 * @see hasDataDefinedProperty * @see getDataDefinedProperty * @note added in QGIS 2.9 + * @deprecated use variant which takes QgsSymbolV2RenderContext instead */ virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature ) const /Deprecated/; @@ -267,6 +268,7 @@ class QgsSymbolLayerV2 * be called prior to evaluating data defined properties. * @param fields associated layer fields * @param scale map scale + * @deprecated use variant which takes QgsSymbolV2RenderContext instead */ virtual void prepareExpressions( const QgsFields* fields, double scale = -1.0 ) /Deprecated/; diff --git a/python/gui/qgsmapcanvas.sip b/python/gui/qgsmapcanvas.sip index d3edac75af26..ee77c78f119b 100644 --- a/python/gui/qgsmapcanvas.sip +++ b/python/gui/qgsmapcanvas.sip @@ -105,7 +105,7 @@ class QgsMapCanvas : QGraphicsView int mapUpdateInterval() const; //! @deprecated since 2.4 - there could be more than just one "map" items - QgsMapCanvasMap* map(); + QgsMapCanvasMap* map() /Deprecated/; //! @deprecated since 2.4 - use mapSettings() for anything related to current renderer settings //// SIP: removed /Transfer/ because it crashes after few calls to iface.mapCanvas().mapRenderer().hasCrsTransformEnabled() diff --git a/python/gui/qgsrubberband.sip b/python/gui/qgsrubberband.sip index 1ad6716bc852..a490c3624873 100644 --- a/python/gui/qgsrubberband.sip +++ b/python/gui/qgsrubberband.sip @@ -109,7 +109,7 @@ class QgsRubberBand: QgsMapCanvasItem * Sets the representation type according to isPolygon. * @param isPolygon true: draw as (multi-)polygon, false draw as (multi-)linestring */ - void reset( bool isPolygon ); + void reset( bool isPolygon ) /Deprecated/; /** * Add a vertex to the rubberband and update canvas. diff --git a/python/gui/symbology-ng/qgsdatadefinedsymboldialog.sip b/python/gui/symbology-ng/qgsdatadefinedsymboldialog.sip index 6d31d1e4e46f..4ac33ec3d2d1 100644 --- a/python/gui/symbology-ng/qgsdatadefinedsymboldialog.sip +++ b/python/gui/symbology-ng/qgsdatadefinedsymboldialog.sip @@ -14,23 +14,38 @@ class QgsDataDefinedSymbolDialog : QDialog DataDefinedSymbolEntry( const QString& p, const QString& t, const QString& v, const QString& h ); }; + //! @deprecated will be removed in QGIS 3.0 QgsDataDefinedSymbolDialog( const QList< QgsDataDefinedSymbolDialog::DataDefinedSymbolEntry >& entries, const QgsVectorLayer* vl, QWidget * parent /TransferThis/ = 0, const Qt::WindowFlags& f = 0 ) /Deprecated/; ~QgsDataDefinedSymbolDialog(); QMap< QString, QString > dataDefinedProperties() const /Deprecated/; //common help texts + //! @deprecated will be removed in QGIS 3.0 static QString doubleHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString colorHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString offsetHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString fileNameHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString horizontalAnchorHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString verticalAnchorHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString gradientTypeHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString gradientCoordModeHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString gradientSpreadHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString boolHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString lineStyleHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString joinStyleHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString capStyleHelpText() /Deprecated/; + //! @deprecated will be removed in QGIS 3.0 static QString fillStyleHelpText() /Deprecated/; }; diff --git a/src/app/gps/qgsgpsinformationwidget.cpp b/src/app/gps/qgsgpsinformationwidget.cpp index 0694dd844b84..08df226526d2 100644 --- a/src/app/gps/qgsgpsinformationwidget.cpp +++ b/src/app/gps/qgsgpsinformationwidget.cpp @@ -834,7 +834,9 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() memcpy( &wkb[5], &x, sizeof( double ) ); memcpy( &wkb[5] + sizeof( double ), &y, sizeof( double ) ); - f->setGeometryAndOwnership( &wkb[0], size ); + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( &wkb[0], size ); + f->setGeometry( g ); QgsFeatureAction action( tr( "Feature added" ), *f, vlayer, -1, -1, this ); if ( action.addFeature() ) @@ -893,7 +895,10 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() memcpy( &wkb[position], &y, sizeof( double ) ); position += sizeof( double ); } - f->setGeometryAndOwnership( &wkb[0], size ); + + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( &wkb[0], size ); + f->setGeometry( g ); } else if ( layerWKBType == QGis::WKBPolygon ) { @@ -934,7 +939,10 @@ void QgsGPSInformationWidget::on_mBtnCloseFeature_clicked() position += sizeof( double ); memcpy( &wkb[position], &y, sizeof( double ) ); - f->setGeometryAndOwnership( &wkb[0], size ); + + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( &wkb[0], size ); + f->setGeometry( g ); int avoidIntersectionsReturn = f->geometry()->avoidIntersections(); if ( avoidIntersectionsReturn == 1 ) @@ -1038,7 +1046,7 @@ void QgsGPSInformationWidget::createRubberBand() { delete mpRubberBand; } - mpRubberBand = new QgsRubberBand( mpCanvas, false ); + mpRubberBand = new QgsRubberBand( mpCanvas, QGis::Line ); mpRubberBand->setColor( mTrackColor ); mpRubberBand->setWidth( mSpinTrackWidth->value() ); mpRubberBand->show(); diff --git a/src/app/qgsattributetabledialog.cpp b/src/app/qgsattributetabledialog.cpp index 8f5e7d6309c0..c08395c6aa74 100644 --- a/src/app/qgsattributetabledialog.cpp +++ b/src/app/qgsattributetabledialog.cpp @@ -117,7 +117,7 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid r.setFilterRect( extent ); QgsGeometry *g = QgsGeometry::fromRect( extent ); - mRubberBand = new QgsRubberBand( mc, true ); + mRubberBand = new QgsRubberBand( mc, QGis::Polygon ); mRubberBand->setToGeometry( g, theLayer ); delete g; diff --git a/src/app/qgsmergeattributesdialog.cpp b/src/app/qgsmergeattributesdialog.cpp index 7121b1880c23..984b40c7535c 100644 --- a/src/app/qgsmergeattributesdialog.cpp +++ b/src/app/qgsmergeattributesdialog.cpp @@ -467,7 +467,7 @@ void QgsMergeAttributesDialog::createRubberBandForFeature( int featureId ) { //create rubber band to highlight the feature delete mSelectionRubberBand; - mSelectionRubberBand = new QgsRubberBand( mMapCanvas, mVectorLayer->geometryType() == QGis::Polygon ); + mSelectionRubberBand = new QgsRubberBand( mMapCanvas, mVectorLayer->geometryType() ); mSelectionRubberBand->setColor( QColor( 255, 0, 0, 65 ) ); QgsFeature featureToSelect; mVectorLayer->getFeatures( QgsFeatureRequest().setFilterFid( featureId ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( featureToSelect ); diff --git a/src/core/composer/qgsatlascomposition.h b/src/core/composer/qgsatlascomposition.h index cad51d2dc489..f5156f79fae9 100644 --- a/src/core/composer/qgsatlascomposition.h +++ b/src/core/composer/qgsatlascomposition.h @@ -286,10 +286,14 @@ class CORE_EXPORT QgsAtlasComposition : public QObject */ Q_DECL_DEPRECATED void setMargin( float margin ); + //! @deprecated use sortKeyAttributeName instead Q_DECL_DEPRECATED int sortKeyAttributeIndex() const; + //! @deprecated use setSortKeyAttributeName instead Q_DECL_DEPRECATED void setSortKeyAttributeIndex( int idx ); - /** Returns the current atlas feature. Must be called after prepareForFeature( i ). */ + /** Returns the current atlas feature. Must be called after prepareForFeature( i ). + * @deprecated use feature() instead + */ Q_DECL_DEPRECATED QgsFeature* currentFeature() { return &mCurrentFeature; } /** Returns the current atlas geometry in the given projection system (default to the coverage layer's CRS) */ diff --git a/src/core/composer/qgscomposeritem.h b/src/core/composer/qgscomposeritem.h index 24ad4162d794..8dcb184c78fc 100644 --- a/src/core/composer/qgscomposeritem.h +++ b/src/core/composer/qgscomposeritem.h @@ -692,7 +692,9 @@ class CORE_EXPORT QgsComposerItem: public QgsComposerObject, public QGraphicsRec */ Q_DECL_DEPRECATED void drawArrowHead( QPainter* p, double x, double y, double angle, double arrowHeadWidth ) const; - /** Returns angle of the line from p1 to p2 (clockwise, starting at N)*/ + /** Returns angle of the line from p1 to p2 (clockwise, starting at N) + * @deprecated will be removed in QGIS 3.0 + */ Q_DECL_DEPRECATED double angle( const QPointF& p1, const QPointF& p2 ) const; /** Returns the current (zoom level dependent) tolerance to decide if mouse position is close enough to the diff --git a/src/core/composer/qgscomposerlegend.h b/src/core/composer/qgscomposerlegend.h index 3434fbdd0f64..e7287bac9bf6 100644 --- a/src/core/composer/qgscomposerlegend.h +++ b/src/core/composer/qgscomposerlegend.h @@ -74,7 +74,7 @@ class CORE_EXPORT QgsComposerLegend : public QgsComposerItem void adjustBoxSize(); /** Returns pointer to the legend model*/ - //! @note deprecated in 2.6 - use modelV2() + //! @deprecated in 2.6 - use modelV2() Q_DECL_DEPRECATED QgsLegendModel* model() {return &mLegendModel;} //! @note added in 2.6 diff --git a/src/core/composer/qgscomposermap.h b/src/core/composer/qgscomposermap.h index 184c7955d54d..f6887b1533ba 100644 --- a/src/core/composer/qgscomposermap.h +++ b/src/core/composer/qgscomposermap.h @@ -779,6 +779,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem /** Transforms map coordinates to item coordinates (considering rotation and move offset)*/ QPointF mapToItemCoords( const QPointF& mapCoords ) const; + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED void connectMapOverviewSignals(); /** Calculates the extent to request and the yShift of the top-left point in case of rotation. diff --git a/src/core/composer/qgscomposertablev2.h b/src/core/composer/qgscomposertablev2.h index b061687da86e..162f66b4e0c5 100644 --- a/src/core/composer/qgscomposertablev2.h +++ b/src/core/composer/qgscomposertablev2.h @@ -593,6 +593,7 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame /** Calculates how many content rows are visible within a given frame * @param frameIndex index number for frame * @returns number of visible content rows (excludes header rows) + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED int rowsVisible( const int frameIndex ) const; @@ -601,6 +602,7 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame * @param frameHeight height of frame * @param includeHeader set to true if frame would include a header row * @returns number of visible content rows (excluding header row) + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED int rowsVisible( const double frameHeight, const bool includeHeader ) const; @@ -609,6 +611,7 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame * @param extent visible extent * @param frameIndex index number for frame * @returns row range + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED QPair rowRange( const QRectF &extent, const int frameIndex ) const; @@ -617,6 +620,7 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame * @param rows number of rows shown in table * @param drawHeaderLines set to true to include for the table header * @see drawVerticalGridLines + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED void drawHorizontalGridLines( QPainter* painter, const int rows, const bool drawHeaderLines ) const; @@ -631,6 +635,7 @@ class CORE_EXPORT QgsComposerTableV2: public QgsComposerMultiFrame * @see drawVerticalGridLines * @see calculateMaxColumnWidths * @note not available in python bindings + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED void drawVerticalGridLines( QPainter* painter, const QMap& maxWidthMap, const int numberRows, const bool hasHeader, const bool mergeCells = false ) const; diff --git a/src/core/composer/qgscomposition.h b/src/core/composer/qgscomposition.h index 9fe83950ad82..61cceeb6c220 100644 --- a/src/core/composer/qgscomposition.h +++ b/src/core/composer/qgscomposition.h @@ -417,6 +417,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene composer user interface item properties). @param item the item. @return QgsComposerHtml pointer or 0 pointer if no such item exists. + @deprecated Use QgsComposerFrame::multiFrame() instead */ Q_DECL_DEPRECATED const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) const; diff --git a/src/core/diagram/qgsdiagram.h b/src/core/diagram/qgsdiagram.h index f77bfa125d88..7912d5f38ba3 100644 --- a/src/core/diagram/qgsdiagram.h +++ b/src/core/diagram/qgsdiagram.h @@ -42,6 +42,7 @@ class CORE_EXPORT QgsDiagram void clearCache(); + //! @deprecated use QgsExpressionContext variant instead Q_DECL_DEPRECATED QgsExpression* getExpression( const QString& expression, const QgsFields* fields ); /** Returns a prepared expression for the specified context. diff --git a/src/core/qgis.h b/src/core/qgis.h index bb2d8411e273..c679c49a5529 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -203,7 +203,7 @@ class CORE_EXPORT QGis /** Old search radius in % of canvas width * @deprecated since 2.3, use DEFAULT_SEARCH_RADIUS_MM */ - static const double DEFAULT_IDENTIFY_RADIUS; + Q_DECL_DEPRECATED static const double DEFAULT_IDENTIFY_RADIUS; /** Identify search radius in mm * @note added in 2.3 */ diff --git a/src/core/qgscachedfeatureiterator.h b/src/core/qgscachedfeatureiterator.h index 04a4bd9d11ad..e73e6e25b4a5 100644 --- a/src/core/qgscachedfeatureiterator.h +++ b/src/core/qgscachedfeatureiterator.h @@ -40,7 +40,7 @@ class CORE_EXPORT QgsCachedFeatureIterator : public QgsAbstractFeatureIterator * @deprecated Use QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, QgsFeatureRequest featureRequest ) * instead */ - QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, const QgsFeatureRequest& featureRequest, const QgsFeatureIds& featureIds ); + Q_DECL_DEPRECATED QgsCachedFeatureIterator( QgsVectorLayerCache* vlCache, const QgsFeatureRequest& featureRequest, const QgsFeatureIds& featureIds ); /** * This constructor creates a feature iterator, that delivers all cached features. No request is made to the backend. diff --git a/src/core/qgsdatadefined.h b/src/core/qgsdatadefined.h index a8d30e4ab338..96fef077ed68 100644 --- a/src/core/qgsdatadefined.h +++ b/src/core/qgsdatadefined.h @@ -146,6 +146,7 @@ class CORE_EXPORT QgsDataDefined /** Prepares the expression using a vector layer * @param layer vector layer * @returns true if expression was successfully prepared + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED bool prepareExpression( QgsVectorLayer* layer ); @@ -153,6 +154,7 @@ class CORE_EXPORT QgsDataDefined * @param fields * @returns true if expression was successfully prepared * @note added in QGIS 2.9 + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED bool prepareExpression( const QgsFields &fields ); @@ -172,12 +174,14 @@ class CORE_EXPORT QgsDataDefined /** Returns the columns referenced by the QgsDataDefined * @param layer vector layer, used for preparing the expression if required + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED QStringList referencedColumns( QgsVectorLayer* layer ); /** Returns the columns referenced by the QgsDataDefined * @param fields vector layer, used for preparing the expression if required * @note added in QGIS 2.9 + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED QStringList referencedColumns( const QgsFields& fields ); diff --git a/src/core/qgsdataitem.h b/src/core/qgsdataitem.h index 1bbc133769f9..3d86da62b03f 100644 --- a/src/core/qgsdataitem.h +++ b/src/core/qgsdataitem.h @@ -116,7 +116,7 @@ class CORE_EXPORT QgsDataItem : public QObject virtual void setState( State state ); //! @deprecated in 2.8, use state() - bool isPopulated() { return state() == Populated; } + Q_DECL_DEPRECATED bool isPopulated() { return state() == Populated; } // Insert new child using alphabetical order based on mName, emits necessary signal to model before and after, sets parent and connects signals // refresh - refresh populated item, emit signals to model diff --git a/src/core/qgsexpression.h b/src/core/qgsexpression.h index 18e6f7c8fb34..ea45b5f89a2e 100644 --- a/src/core/qgsexpression.h +++ b/src/core/qgsexpression.h @@ -107,6 +107,7 @@ class CORE_EXPORT QgsExpression const Node* rootNode() const { return mRootNode; } //! Get the expression ready for evaluation - find out column indexes. + //! @deprecated use prepare( const QgsExpressionContext *context ) instead Q_DECL_DEPRECATED bool prepare( const QgsFields &fields ); /** Get the expression ready for evaluation - find out column indexes. @@ -132,20 +133,24 @@ class CORE_EXPORT QgsExpression //! Evaluate the feature and return the result //! @note prepare() should be called before calling this method + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead Q_DECL_DEPRECATED QVariant evaluate( const QgsFeature* f ); //! Evaluate the feature and return the result //! @note prepare() should be called before calling this method //! @note available in python bindings as evaluatePrepared + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead Q_DECL_DEPRECATED QVariant evaluate( const QgsFeature& f ); //! Evaluate the feature and return the result //! @note this method does not expect that prepare() has been called on this instance + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead Q_DECL_DEPRECATED QVariant evaluate( const QgsFeature* f, const QgsFields& fields ); //! Evaluate the feature and return the result //! @note this method does not expect that prepare() has been called on this instance //! @note not available in python bindings + //! @deprecated use evaluate( const QgsExpressionContext* context ) instead Q_DECL_DEPRECATED QVariant evaluate( const QgsFeature& f, const QgsFields& fields ); /** Evaluate the feature and return the result. @@ -169,8 +174,10 @@ class CORE_EXPORT QgsExpression void setEvalErrorString( const QString& str ) { mEvalErrorString = str; } //! Set the number for $rownum special column + //! @deprecated use QgsExpressionContext to set row number instead Q_DECL_DEPRECATED void setCurrentRowNumber( int rowNumber ) { mRowNumber = rowNumber; } //! Return the number used for $rownum special column + //! @deprecated use QgsExpressionContext to retrieve row number instead Q_DECL_DEPRECATED int currentRowNumber() { return mRowNumber; } //TODO QGIS 3.0: make the following methods private. They are still required for replaceExpressionText @@ -198,6 +205,7 @@ class CORE_EXPORT QgsExpression */ bool isField() const { return rootNode() && dynamic_cast( rootNode() ) ;} + //! @deprecated use QgsExpressionContext variant instead Q_DECL_DEPRECATED static bool isValid( const QString& text, const QgsFields& fields, QString &errorMessage ); /** Tests whether a string is a valid expression. @@ -245,6 +253,7 @@ class CORE_EXPORT QgsExpression @param substitutionMap @param distanceArea optional QgsDistanceArea. If specified, the QgsDistanceArea is used for distance and area conversion + @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED static QString replaceExpressionText( const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, @@ -407,6 +416,7 @@ class CORE_EXPORT QgsExpression /** The help text for the function. */ const QString helptext() { return mHelpText.isEmpty() ? QgsExpression::helptext( mName ) : mHelpText; } + //! @deprecated Use QgsExpressionContext variant instead Q_DECL_DEPRECATED virtual QVariant func( const QVariantList&, const QgsFeature*, QgsExpression* ); /** Returns result of evaluating the function. @@ -444,6 +454,7 @@ class CORE_EXPORT QgsExpression class StaticFunction : public Function { public: + //! @deprecated use QgsExpressionContext variant instead Q_DECL_DEPRECATED StaticFunction( const QString& fnname, int params, FcnEval fcn, @@ -480,6 +491,7 @@ class CORE_EXPORT QgsExpression , mAliases( aliases ) {} + //! @deprecated use QgsExpressionContext variant instead Q_DECL_DEPRECATED virtual QVariant func( const QVariantList& values, const QgsFeature* f, QgsExpression* parent ) override; /** Returns result of evaluating the function. @@ -606,6 +618,7 @@ class CORE_EXPORT QgsExpression /** * Abstract virtual eval method * Errors are reported to the parent + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED virtual QVariant eval( QgsExpression* parent, const QgsFeature* f ); @@ -619,6 +632,7 @@ class CORE_EXPORT QgsExpression /** * Abstract virtual preparation method * Errors are reported to the parent + * @deprecated use QgsExpressionContext variant instead */ Q_DECL_DEPRECATED virtual bool prepare( QgsExpression* parent, const QgsFields &fields ); diff --git a/src/core/qgsfeature.h b/src/core/qgsfeature.h index 14d0227d63a0..98a941b9a8c0 100644 --- a/src/core/qgsfeature.h +++ b/src/core/qgsfeature.h @@ -305,6 +305,7 @@ class CORE_EXPORT QgsFeature * @returns pointer to feature's geometry * @see geometry * @see setGeometry + * @deprecated use constGeometry() instead */ Q_DECL_DEPRECATED QgsGeometry *geometryAndOwnership(); @@ -326,7 +327,6 @@ class CORE_EXPORT QgsFeature * @see constGeometry * @see geometryAndOwnership * @see setGeometryAndOwnership - * @deprecated will be removed in QGIS 3.0 */ void setGeometry( QgsGeometry* geom ); @@ -340,7 +340,7 @@ class CORE_EXPORT QgsFeature * @see geometryAndOwnership * @deprecated will be removed in QGIS 3.0 */ - void setGeometryAndOwnership( unsigned char * geom, size_t length ); + Q_DECL_DEPRECATED void setGeometryAndOwnership( unsigned char * geom, size_t length ); /** Assign a field map with the feature to allow attribute access by attribute name. * @param fields The attribute fields which this feature holds diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index d1cf708c26ab..f08bd5b2f4fd 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -381,7 +381,9 @@ void QgsGml::endElement( const XML_Char* el ) Q_ASSERT( mCurrentFeature ); if ( mCurrentWKBSize > 0 ) { - mCurrentFeature->setGeometryAndOwnership( mCurrentWKB, mCurrentWKBSize ); + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( mCurrentWKB, mCurrentWKBSize ); + mCurrentFeature->setGeometry( g ); mCurrentWKB = 0; } else if ( !mCurrentExtent.isEmpty() ) diff --git a/src/core/qgslegacyhelpers.h b/src/core/qgslegacyhelpers.h index 16b1bcf6489e..7397afa17794 100644 --- a/src/core/qgslegacyhelpers.h +++ b/src/core/qgslegacyhelpers.h @@ -23,7 +23,10 @@ class CORE_EXPORT QgsLegacyHelpers { public: + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static const QString convertEditType( QgsVectorLayer::EditType editType, QgsEditorWidgetConfig& cfg, QgsVectorLayer* vl, const QString& name, const QDomElement &editTypeElement = QDomElement() ); + + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QgsVectorLayer::EditType convertEditType( const QString& editType, const QgsEditorWidgetConfig& cfg, QgsVectorLayer* vl, const QString& name ); private: diff --git a/src/core/qgsmaplayer.h b/src/core/qgsmaplayer.h index 56c09a4bec48..9019f1986e31 100644 --- a/src/core/qgsmaplayer.h +++ b/src/core/qgsmaplayer.h @@ -487,7 +487,7 @@ class CORE_EXPORT QgsMapLayer : public QObject signals: //! @deprecated in 2.4 - not emitted anymore - void drawingProgress( int theProgress, int theTotalSteps ); + Q_DECL_DEPRECATED void drawingProgress( int theProgress, int theTotalSteps ); /** Emit a signal with status (e.g. to be caught by QgisApp and display a msg on status bar) */ void statusChanged( const QString& theStatus ); diff --git a/src/core/qgsowsconnection.h b/src/core/qgsowsconnection.h index 2ade2684f0e3..145da789511d 100644 --- a/src/core/qgsowsconnection.h +++ b/src/core/qgsowsconnection.h @@ -55,6 +55,7 @@ class CORE_EXPORT QgsOWSConnection : public QObject QgsDataSourceURI uri(); QString mConnectionInfo; + //! @deprecated use mConnectionInfo instead Q_DECL_DEPRECATED QString connectionInfo(); private: diff --git a/src/core/qgssnapper.h b/src/core/qgssnapper.h index dffb22666f0a..0d5667e763ac 100644 --- a/src/core/qgssnapper.h +++ b/src/core/qgssnapper.h @@ -94,7 +94,7 @@ class CORE_EXPORT QgsSnapper QgsTolerance::UnitType mUnitType; }; - //!@ deprecated since 2.4 - use constructor with QgsMapSettings + //!@deprecated since 2.4 - use constructor with QgsMapSettings Q_DECL_DEPRECATED QgsSnapper( QgsMapRenderer *mapRender ); explicit QgsSnapper( const QgsMapSettings& mapSettings ); diff --git a/src/core/qgsvectorlayer.h b/src/core/qgsvectorlayer.h index d4a6a36a31c4..1e67e18a4d38 100644 --- a/src/core/qgsvectorlayer.h +++ b/src/core/qgsvectorlayer.h @@ -399,7 +399,9 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer struct RangeData { + //! @deprecated Use the editorWidgetV2() system instead Q_DECL_DEPRECATED RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVariant( 1 );} + //! @deprecated Use the editorWidgetV2() system instead Q_DECL_DEPRECATED RangeData( const QVariant& theMin, const QVariant& theMax, const QVariant& theStep ) : mMin( theMin ), mMax( theMax ), mStep( theStep ) {} @@ -789,7 +791,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer * * @deprecated Will be removed for QGIS 3 in favor of importNamedStyle */ - virtual bool applyNamedStyle( const QString& namedStyle, QString &errorMsg ); + Q_DECL_DEPRECATED virtual bool applyNamedStyle( const QString& namedStyle, QString &errorMsg ); /** Convert a saved attribute editor element into a AttributeEditor structure as it's used internally. * @param elem the DOM element @@ -1066,7 +1068,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer bool draw( QgsRenderContext& rendererContext ) override; /** Draws the layer labels using the old labeling engine - * @note deprecated + * @deprecated will be removed in QGIS 3.0 */ Q_DECL_DEPRECATED void drawLabels( QgsRenderContext& rendererContext ) override; diff --git a/src/core/raster/qgsrasterlayer.h b/src/core/raster/qgsrasterlayer.h index 36268431b80f..132925716f0b 100644 --- a/src/core/raster/qgsrasterlayer.h +++ b/src/core/raster/qgsrasterlayer.h @@ -311,7 +311,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer void setDefaultContrastEnhancement(); /** \brief Overloaded version of the above function for convenience when restoring from xml - * @note Deprecated since QGIS 2.10. Use setRendererForDrawingStyle() or directly setRenderer() + * @deprecated Deprecated since QGIS 2.10. Use setRendererForDrawingStyle() or directly setRenderer() */ Q_DECL_DEPRECATED void setDrawingStyle( const QString & theDrawingStyleQString ); @@ -322,7 +322,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer virtual QStringList subLayers() const override; /** \brief Draws a preview of the rasterlayer into a pixmap - @note - use previewAsImage() for rendering with QGIS>=2.4 */ + @deprecated use previewAsImage() for rendering with QGIS>=2.4 */ Q_DECL_DEPRECATED QPixmap previewAsPixmap( const QSize& size, const QColor& bgColor = Qt::white ); /** \brief Draws a preview of the rasterlayer into a QImage diff --git a/src/core/symbology-ng/qgsrendererv2.h b/src/core/symbology-ng/qgsrendererv2.h index 91005ecb054f..f55277a13f42 100644 --- a/src/core/symbology-ng/qgsrendererv2.h +++ b/src/core/symbology-ng/qgsrendererv2.h @@ -84,6 +84,7 @@ class CORE_EXPORT QgsFeatureRendererV2 /** To be overridden * @param feature feature * @return returns pointer to symbol or 0 if symbol was not found + * @deprecated use symbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead */ Q_DECL_DEPRECATED virtual QgsSymbolV2* symbolForFeature( QgsFeature& feature ); @@ -103,6 +104,7 @@ class CORE_EXPORT QgsFeatureRendererV2 * symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement * of a symbol for use in rendering. * @note added in 2.6 + * @deprecated use originalSymbolForFeature( QgsFeature& feature, QgsRenderContext& context ) instead */ Q_DECL_DEPRECATED virtual QgsSymbolV2* originalSymbolForFeature( QgsFeature& feature ); @@ -166,7 +168,9 @@ class CORE_EXPORT QgsFeatureRendererV2 //! returns bitwise OR-ed capabilities of the renderer virtual int capabilities() { return 0; } - //! for symbol levels + /** For symbol levels + * @deprecated use symbols( QgsRenderContext& context ) instead + */ Q_DECL_DEPRECATED virtual QgsSymbolV2List symbols(); /** Returns list of symbols used by the renderer. @@ -248,9 +252,11 @@ class CORE_EXPORT QgsFeatureRendererV2 //! @deprecated use the symbol's methods instead Q_DECL_DEPRECATED virtual void setRotationField( const QString& fieldName ) { Q_UNUSED( fieldName ); } - //! return whether the renderer will render a feature or not. - //! Must be called between startRender() and stopRender() calls. - //! Default implementation uses symbolForFeature(). + /** Returns whether the renderer will render a feature or not. + * Must be called between startRender() and stopRender() calls. + * Default implementation uses symbolForFeature(). + * @deprecated use willRenderFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ Q_DECL_DEPRECATED virtual bool willRenderFeature( QgsFeature& feat ); /** Returns whether the renderer will render a feature or not. @@ -262,9 +268,11 @@ class CORE_EXPORT QgsFeatureRendererV2 //TODO - QGIS 3.0 change PyName to willRenderFeature when deprecated method is removed virtual bool willRenderFeature( QgsFeature& feat, QgsRenderContext& context ); - //! return list of symbols used for rendering the feature. - //! For renderers that do not support MoreSymbolsPerFeature it is more efficient - //! to use symbolForFeature() + /** Returns list of symbols used for rendering the feature. + * For renderers that do not support MoreSymbolsPerFeature it is more efficient + * to use symbolForFeature() + * @deprecated use symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ Q_DECL_DEPRECATED virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat ); /** Returns list of symbols used for rendering the feature. @@ -276,9 +284,11 @@ class CORE_EXPORT QgsFeatureRendererV2 //TODO - QGIS 3.0 change PyName to symbolsForFeature when deprecated method is removed virtual QgsSymbolV2List symbolsForFeature( QgsFeature& feat, QgsRenderContext& context ); - //! Equivalent of originalSymbolsForFeature() call - //! extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() - //! @note added in 2.6 + /** Equivalent of originalSymbolsForFeature() call + * extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() + * @note added in 2.6 + * @deprecated use originalSymbolsForFeature( QgsFeature& feat, QgsRenderContext& context ) instead + */ Q_DECL_DEPRECATED virtual QgsSymbolV2List originalSymbolsForFeature( QgsFeature& feat ); /** Equivalent of originalSymbolsForFeature() call diff --git a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp index def5473a9802..fecef047afbf 100644 --- a/src/core/symbology-ng/qgsrulebasedrendererv2.cpp +++ b/src/core/symbology-ng/qgsrulebasedrendererv2.cpp @@ -261,7 +261,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::clone() const { QgsSymbolV2* sym = mSymbol ? mSymbol->clone() : NULL; Rule* newrule = new Rule( sym, mScaleMinDenom, mScaleMaxDenom, mFilterExp, mLabel, mDescription ); - newrule->setCheckState( mIsActive ); + newrule->setActive( mIsActive ); // clone children Q_FOREACH ( Rule* rule, mChildren ) newrule->appendChild( rule->clone() ); @@ -652,7 +652,7 @@ QgsRuleBasedRendererV2::Rule* QgsRuleBasedRendererV2::Rule::create( QDomElement& if ( !ruleKey.isEmpty() ) rule->mRuleKey = ruleKey; - rule->setCheckState( ruleElem.attribute( "checkstate", "1" ).toInt() ); + rule->setActive( ruleElem.attribute( "checkstate", "1" ).toInt() ); QDomElement childRuleElem = ruleElem.firstChildElement( "rule" ); while ( !childRuleElem.isNull() ) @@ -987,7 +987,7 @@ void QgsRuleBasedRendererV2::checkLegendSymbolItem( const QString& key, bool sta { Rule* rule = mRootRule->findRuleByKey( key ); if ( rule ) - rule->setCheckState( state ); + rule->setActive( state ); } QgsLegendSymbolList QgsRuleBasedRendererV2::legendSymbolItems( double scaleDenominator, const QString& rule ) diff --git a/src/core/symbology-ng/qgsrulebasedrendererv2.h b/src/core/symbology-ng/qgsrulebasedrendererv2.h index c3e3e58fe49a..ccb0db1ace2c 100644 --- a/src/core/symbology-ng/qgsrulebasedrendererv2.h +++ b/src/core/symbology-ng/qgsrulebasedrendererv2.h @@ -164,6 +164,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2 //! @note added in 2.6 //! @deprecated use active instead Q_DECL_DEPRECATED bool checkState() const { return mIsActive; } + /** * Returns if this rule is active * @@ -214,7 +215,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2 //! @note added in 2.6 //! @deprecated use setActive instead - void setCheckState( bool state ) { mIsActive = state; } + Q_DECL_DEPRECATED void setCheckState( bool state ) { mIsActive = state; } /** * Sets if this rule is active @@ -230,7 +231,9 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2 QDomElement save( QDomDocument& doc, QgsSymbolV2Map& symbolMap ); - //! prepare the rule for rendering and its children (build active children array) + /** Prepare the rule for rendering and its children (build active children array) + * @deprecated use startRender( QgsRenderContext& context, const QgsFields& fields, QString& filter ) instead + */ Q_DECL_DEPRECATED bool startRender( QgsRenderContext& context, const QgsFields& fields ); //! prepare the rule for rendering and its children (build active children array) diff --git a/src/core/symbology-ng/qgssymbollayerv2.h b/src/core/symbology-ng/qgssymbollayerv2.h index 17fe1330c58a..52350cceab4f 100644 --- a/src/core/symbology-ng/qgssymbollayerv2.h +++ b/src/core/symbology-ng/qgssymbollayerv2.h @@ -198,6 +198,7 @@ class CORE_EXPORT QgsSymbolLayerV2 * @see hasDataDefinedProperty * @see getDataDefinedProperty * @note added in QGIS 2.9 + * @deprecated use variant which takes QgsSymbolV2RenderContext instead */ Q_DECL_DEPRECATED virtual QVariant evaluateDataDefinedProperty( const QString& property, const QgsFeature* feature, const QVariant& defaultVal = QVariant(), bool *ok = 0 ) const; @@ -268,6 +269,7 @@ class CORE_EXPORT QgsSymbolLayerV2 * be called prior to evaluating data defined properties. * @param fields associated layer fields * @param scale map scale + * @deprecated use variant which takes QgsSymbolV2RenderContext instead */ Q_DECL_DEPRECATED virtual void prepareExpressions( const QgsFields* fields, double scale = -1.0 ); diff --git a/src/gui/qgsattributedialog.h b/src/gui/qgsattributedialog.h index 12b67d99bfe4..fec34469250a 100644 --- a/src/gui/qgsattributedialog.h +++ b/src/gui/qgsattributedialog.h @@ -49,7 +49,7 @@ class GUI_EXPORT QgsAttributeDialog : public QDialog * * @deprecated */ - QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = 0, bool showDialogButtons = true ); + Q_DECL_DEPRECATED QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature, bool featureOwner, const QgsDistanceArea& myDa, QWidget* parent = 0, bool showDialogButtons = true ); /** * Create an attribute dialog for a given layer and feature diff --git a/src/gui/qgsmapcanvas.h b/src/gui/qgsmapcanvas.h index 1c64531e725b..12334fe00149 100644 --- a/src/gui/qgsmapcanvas.h +++ b/src/gui/qgsmapcanvas.h @@ -177,7 +177,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView int mapUpdateInterval() const; //! @deprecated since 2.4 - there could be more than just one "map" items - QgsMapCanvasMap* map(); + Q_DECL_DEPRECATED QgsMapCanvasMap* map(); //! @deprecated since 2.4 - use mapSettings() for anything related to current renderer settings //// SIP: removed /Transfer/ because it crashes after few calls to iface.mapCanvas().mapRenderer().hasCrsTransformEnabled() diff --git a/src/gui/qgsmaptoolcapture.cpp b/src/gui/qgsmaptoolcapture.cpp index 4f8fea138c41..c5019b4a748e 100644 --- a/src/gui/qgsmaptoolcapture.cpp +++ b/src/gui/qgsmaptoolcapture.cpp @@ -218,7 +218,7 @@ int QgsMapToolCapture::addVertex( const QgsPoint& point ) } else { - mTempRubberBand->reset( mCaptureMode == CapturePolygon ? true : false ); + mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QGis::Polygon : QGis::Line ); } if ( mCaptureMode == CaptureLine ) { @@ -308,7 +308,7 @@ void QgsMapToolCapture::undo() } else { - mTempRubberBand->reset( mCaptureMode == CapturePolygon ? true : false ); + mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QGis::Polygon : QGis::Line ); } QgsVertexId vertexToRemove; diff --git a/src/gui/qgsrubberband.h b/src/gui/qgsrubberband.h index a0bec00c259f..6a8ced1a3c14 100644 --- a/src/gui/qgsrubberband.h +++ b/src/gui/qgsrubberband.h @@ -74,7 +74,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem * @param mapCanvas The map canvas to draw onto. It's CRS will be used map points onto screen coordinates. * @param isPolygon true: draw as (multi-)polygon, false draw as (multi-)linestring */ - QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ); + Q_DECL_DEPRECATED QgsRubberBand( QgsMapCanvas* mapCanvas, bool isPolygon ); ~QgsRubberBand(); /** @@ -137,7 +137,7 @@ class GUI_EXPORT QgsRubberBand: public QgsMapCanvasItem * Sets the representation type according to isPolygon. * @param isPolygon true: draw as (multi-)polygon, false draw as (multi-)linestring */ - void reset( bool isPolygon ); + Q_DECL_DEPRECATED void reset( bool isPolygon ); /** * Add a vertex to the rubberband and update canvas. diff --git a/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h b/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h index 676d02bc709a..9ea996886829 100644 --- a/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h +++ b/src/gui/symbology-ng/qgsdatadefinedsymboldialog.h @@ -27,24 +27,41 @@ class GUI_EXPORT QgsDataDefinedSymbolDialog: public QDialog, private Ui::QgsData QString helpText; }; + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED QgsDataDefinedSymbolDialog( const QList< DataDefinedSymbolEntry >& entries, const QgsVectorLayer* vl, QWidget * parent = 0, const Qt::WindowFlags& f = 0 ); ~QgsDataDefinedSymbolDialog(); + + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED QMap< QString, QString > dataDefinedProperties() const; //common help texts + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString doubleHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString colorHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString offsetHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString fileNameHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString horizontalAnchorHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString verticalAnchorHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString gradientTypeHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString gradientCoordModeHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString gradientSpreadHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString boolHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString lineStyleHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString joinStyleHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString capStyleHelpText(); + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED static QString fillStyleHelpText(); private: diff --git a/src/gui/symbology-ng/qgsrendererv2widget.h b/src/gui/symbology-ng/qgsrendererv2widget.h index 1ff322aef026..2a9a4f0388bc 100644 --- a/src/gui/symbology-ng/qgsrendererv2widget.h +++ b/src/gui/symbology-ng/qgsrendererv2widget.h @@ -122,6 +122,7 @@ class QgsRendererV2DataDefinedMenus : public QObject public: + //! @deprecated will be removed in QGIS 3.0 Q_DECL_DEPRECATED QgsRendererV2DataDefinedMenus( QMenu* menu, QgsVectorLayer* layer, const QString& rotationField, const QString& sizeScaleField, QgsSymbolV2::ScaleMethod scaleMethod ); ~QgsRendererV2DataDefinedMenus(); diff --git a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp index 610c9ac8d2d0..8aee2e181f5b 100644 --- a/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp @@ -950,7 +950,7 @@ bool QgsRuleBasedRendererV2Model::setData( const QModelIndex & index, const QVar if ( role == Qt::CheckStateRole ) { - rule->setCheckState( value.toInt() == Qt::Checked ); + rule->setActive( value.toInt() == Qt::Checked ); emit dataChanged( index, index ); return true; } diff --git a/src/plugins/topology/checkDock.cpp b/src/plugins/topology/checkDock.cpp index 122581d34353..99a3f0796c63 100644 --- a/src/plugins/topology/checkDock.cpp +++ b/src/plugins/topology/checkDock.cpp @@ -366,7 +366,7 @@ void checkDock::runTests( ValidateType type ) QSettings settings; if ( te->conflict()->type() == QGis::Polygon ) { - rb = new QgsRubberBand( qgsInterface->mapCanvas(), true ); + rb = new QgsRubberBand( qgsInterface->mapCanvas(), QGis::Polygon ); } else { diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index 1591cdfca8ae..d4a0e007a981 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -176,7 +176,9 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature& feature ) unsigned char* wkb = mParser.ParseSqlGeometry(( unsigned char* )ar.data(), ar.size() ); if ( wkb ) { - feature.setGeometryAndOwnership( wkb, mParser.GetWkbLen() ); + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( wkb, mParser.GetWkbLen() ); + feature.setGeometry( g ); } } diff --git a/src/providers/ogr/qgsogrfeatureiterator.cpp b/src/providers/ogr/qgsogrfeatureiterator.cpp index 23d8e8406e21..d5c7dc000ba2 100644 --- a/src/providers/ogr/qgsogrfeatureiterator.cpp +++ b/src/providers/ogr/qgsogrfeatureiterator.cpp @@ -328,7 +328,16 @@ bool QgsOgrFeatureIterator::readFeature( OGRFeatureH fet, QgsFeature& feature ) OGR_G_ExportToWkb( geom, ( OGRwkbByteOrder ) QgsApplication::endian(), wkb ); QgsGeometry* geometry = feature.geometry(); - if ( !geometry ) feature.setGeometryAndOwnership( wkb, memorySize ); else geometry->fromWkb( wkb, memorySize ); + if ( !geometry ) + { + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( wkb, memorySize ); + feature.setGeometry( g ); + } + else + { + geometry->fromWkb( wkb, memorySize ); + } } else feature.setGeometry( 0 ); diff --git a/src/providers/postgres/qgspostgresfeatureiterator.cpp b/src/providers/postgres/qgspostgresfeatureiterator.cpp index bf129642db7a..23cf7f85ba83 100644 --- a/src/providers/postgres/qgspostgresfeatureiterator.cpp +++ b/src/providers/postgres/qgspostgresfeatureiterator.cpp @@ -567,11 +567,13 @@ bool QgsPostgresFeatureIterator::getFeature( QgsPostgresResult &queryResult, int } } - feature.setGeometryAndOwnership( featureGeom, returnedLength + 1 ); + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( featureGeom, returnedLength + 1 ); + feature.setGeometry( g ); } else { - feature.setGeometryAndOwnership( 0, 0 ); + feature.setGeometry( 0 ); } col++; diff --git a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp index 815662ab8d9d..6ec09bb5dfab 100644 --- a/src/providers/spatialite/qgsspatialitefeatureiterator.cpp +++ b/src/providers/spatialite/qgsspatialitefeatureiterator.cpp @@ -19,6 +19,7 @@ #include "qgsspatialiteprovider.h" #include "qgsspatialiteexpressioncompiler.h" +#include "qgsgeometry.h" #include "qgslogger.h" #include "qgsmessagelog.h" #include @@ -379,7 +380,7 @@ bool QgsSpatiaLiteFeatureIterator::getFeature( sqlite3_stmt *stmt, QgsFeature &f if ( !mFetchGeometry ) { // no geometry was required - feature.setGeometryAndOwnership( 0, 0 ); + feature.setGeometry( 0 ); } feature.initAttributes( mSource->mFields.count() ); @@ -474,14 +475,18 @@ void QgsSpatiaLiteFeatureIterator::getFeatureGeometry( sqlite3_stmt* stmt, int i QgsSpatiaLiteProvider::convertToGeosWKB(( const unsigned char * )blob, blob_size, &featureGeom, &geom_size ); if ( featureGeom ) - feature.setGeometryAndOwnership( featureGeom, geom_size ); + { + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( featureGeom, geom_size ); + feature.setGeometry( g ); + } else - feature.setGeometryAndOwnership( 0, 0 ); + feature.setGeometry( 0 ); } else { // NULL geometry - feature.setGeometryAndOwnership( 0, 0 ); + feature.setGeometry( 0 ); } } diff --git a/src/providers/wfs/qgswfsfeatureiterator.cpp b/src/providers/wfs/qgswfsfeatureiterator.cpp index ecaf0c774ca1..9e3aec2929fc 100644 --- a/src/providers/wfs/qgswfsfeatureiterator.cpp +++ b/src/providers/wfs/qgswfsfeatureiterator.cpp @@ -119,7 +119,10 @@ void QgsWFSFeatureIterator::copyFeature( const QgsFeature* f, QgsFeature& featur int geomSize = geometry->wkbSize(); unsigned char* copiedGeom = new unsigned char[geomSize]; memcpy( copiedGeom, geom, geomSize ); - feature.setGeometryAndOwnership( copiedGeom, geomSize ); + + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( copiedGeom, geomSize ); + feature.setGeometry( g ); } else { diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index 610aa37ca610..cb7b1e5daf74 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -2718,7 +2718,9 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs OGR_G_ExportToWkb( ogrGeom, ( OGRwkbByteOrder ) QgsApplication::endian(), wkb ); OGR_G_DestroyGeometry( ogrGeom ); - feature.setGeometryAndOwnership( wkb, wkbSize ); + QgsGeometry *g = new QgsGeometry(); + g->fromWkb( wkb, wkbSize ); + feature.setGeometry( g ); if ( coordinateTransform && feature.constGeometry() ) { diff --git a/tests/src/core/testqgsfeature.cpp b/tests/src/core/testqgsfeature.cpp index bc3103212cd3..e62915ae51b7 100644 --- a/tests/src/core/testqgsfeature.cpp +++ b/tests/src/core/testqgsfeature.cpp @@ -289,6 +289,7 @@ void TestQgsFeature::geometry() QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() ); //setGeometryAndOwnership + Q_NOWARN_DEPRECATED_PUSH copy = feature; QCOMPARE( *copy.constGeometry()->asWkb(), *mGeometry.data()->asWkb() ); size_t wkbSize = mGeometry2->wkbSize(); @@ -299,7 +300,6 @@ void TestQgsFeature::geometry() QCOMPARE( *feature.constGeometry()->asWkb(), *mGeometry.data()->asWkb() ); //geometryAndOwnership - Q_NOWARN_DEPRECATED_PUSH copy = feature; QCOMPARE( *copy.constGeometry()->asWkb(), *mGeometry.data()->asWkb() ); QgsGeometry* geom1 = copy.geometryAndOwnership(); diff --git a/tests/src/gui/testqgsrubberband.cpp b/tests/src/gui/testqgsrubberband.cpp index 6eb32c8000d5..e5715b08bb6b 100644 --- a/tests/src/gui/testqgsrubberband.cpp +++ b/tests/src/gui/testqgsrubberband.cpp @@ -178,7 +178,7 @@ void TestQgsRubberband::testVisibility() QCOMPARE( mRubberband->isVisible(), true ); // Add point without update - mRubberband->reset( true ); + mRubberband->reset( QGis::Polygon ); mRubberband->addPoint( QgsPoint( 10, 10 ), false ); QCOMPARE( mRubberband->isVisible(), false ); diff --git a/tests/src/python/utilities.py b/tests/src/python/utilities.py index a8a1af8d93c1..7210111f872c 100644 --- a/tests/src/python/utilities.py +++ b/tests/src/python/utilities.py @@ -766,14 +766,34 @@ def isDeprecated(self, member_elem): :param member_elem: XML element for a class member """ + #look for both Q_DECL_DEPRECATED and Doxygen deprecated tag + decl_deprecated = False type_elem = member_elem.find('type') try: if 'Q_DECL_DEPRECATED' in type_elem.text: - return True + decl_deprecated = True except: pass - return False + doxy_deprecated = False + try: + for p in member_elem.find('detaileddescription').getiterator('para'): + for s in p.getiterator('xrefsect'): + if s.find('xreftitle') is not None and 'Deprecated' in s.find('xreftitle').text: + doxy_deprecated = True + break + except: + assert 0, member_elem.find('definition').text + + if not decl_deprecated and not doxy_deprecated: + return False + + #only functions for now, but in future this should also apply for enums and variables + if member_elem.get('kind') in ('function', 'variable'): + assert decl_deprecated, 'Error: Missing Q_DECL_DEPRECATED for {}'.format(member_elem.find('definition').text) + assert doxy_deprecated, 'Error: Missing Doxygen deprecated tag for {}'.format(member_elem.find('definition').text) + + return True def memberIsDocumented(self, member_elem): """ Tests whether an member has documentation