Skip to content
Permalink
Browse files

Fix API break of QgsMapLayer class introduced in 2.16

This breakage was resulting in a Python error when using plugin layers
due to calls to pure virtual method writeStyle()
  • Loading branch information
wonder-sk committed Jun 22, 2016
1 parent b040410 commit 8fcac87f9d94ed8d5775baeb60b176acf9379cbc
Showing with 33 additions and 6 deletions.
  1. +9 −3 python/core/qgsmaplayer.sip
  2. +15 −0 src/core/qgsmaplayer.cpp
  3. +9 −3 src/core/qgsmaplayer.h
@@ -462,8 +462,10 @@ class QgsMapLayer : QObject
* @param node node that will contain the style definition for this layer.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
* @note added in 2.16
* @note To be implemented in subclasses. Default implementation does nothing and returns false.
*/
virtual bool readStyle( const QDomNode& node, QString& errorMessage ) = 0;
virtual bool readStyle( const QDomNode& node, QString& errorMessage );

/** Write the symbology for the layer into the docment provided.
* @param node the node that will have the style element added to it.
@@ -478,13 +480,17 @@ class QgsMapLayer : QObject
* @param doc the document that will have the QDomNode added.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
* @note added in 2.16
* @note To be implemented in subclasses. Default implementation does nothing and returns false.
*/
virtual bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const = 0;
virtual bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;

/** Return pointer to layer's undo stack */
QUndoStack *undoStack();

/** Return pointer to layer's style undo stack */
/** Return pointer to layer's style undo stack
* @note added in 2.16
*/
QUndoStack *undoStackStyles();

/* Layer legendUrl information */
@@ -1609,6 +1609,21 @@ QString QgsMapLayer::loadSldStyle( const QString &theURI, bool &theResultFlag )
return "";
}

bool QgsMapLayer::readStyle( const QDomNode& node, QString& errorMessage )
{
Q_UNUSED( node );
Q_UNUSED( errorMessage );
return false;
}

bool QgsMapLayer::writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const
{
Q_UNUSED( node );
Q_UNUSED( doc );
Q_UNUSED( errorMessage );
return false;
}


QUndoStack* QgsMapLayer::undoStack()
{
@@ -482,8 +482,10 @@ class CORE_EXPORT QgsMapLayer : public QObject
* @param node node that will contain the style definition for this layer.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
* @note added in 2.16
* @note To be implemented in subclasses. Default implementation does nothing and returns false.
*/
virtual bool readStyle( const QDomNode& node, QString& errorMessage ) = 0;
virtual bool readStyle( const QDomNode& node, QString& errorMessage );

/** Write the symbology for the layer into the docment provided.
* @param node the node that will have the style element added to it.
@@ -498,13 +500,17 @@ class CORE_EXPORT QgsMapLayer : public QObject
* @param doc the document that will have the QDomNode added.
* @param errorMessage reference to string that will be updated with any error messages
* @return true in case of success.
* @note added in 2.16
* @note To be implemented in subclasses. Default implementation does nothing and returns false.
*/
virtual bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const = 0;
virtual bool writeStyle( QDomNode& node, QDomDocument& doc, QString& errorMessage ) const;

/** Return pointer to layer's undo stack */
QUndoStack *undoStack();

/** Return pointer to layer's style undo stack */
/** Return pointer to layer's style undo stack
* @note added in 2.16
*/
QUndoStack *undoStackStyles();

/* Layer legendUrl information */

1 comment on commit 8fcac87

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 commented on 8fcac87 Jun 22, 2016

Sorry about that. Thanks for the fix.

Please sign in to comment.
You can’t perform that action at this time.