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()
This commit is contained in:
Martin Dobias 2016-06-22 20:03:39 +02:00
parent b040410c5e
commit 8fcac87f9d
3 changed files with 33 additions and 6 deletions

View File

@ -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 */

View File

@ -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()
{

View File

@ -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 */