35  return !mXmlData.isEmpty();
 
 
   54  if ( !errorMsg.isEmpty() )
 
   56    QgsDebugError( 
"Failed to export style from layer: " + errorMsg );
 
   61  QTextStream stream( &mXmlData );
 
   62  doc.documentElement().save( stream, 0 );
 
 
   72  QDomDocument doc( QStringLiteral( 
"qgis" ) );
 
   73  if ( !doc.setContent( mXmlData ) )
 
   75    QgsDebugError( QStringLiteral( 
"Failed to parse XML of previously stored XML data - this should not happen!" ) );
 
   82    QgsDebugError( 
"Failed to import style to layer: " + errorMsg );
 
 
   89  QTextStream stream( &mXmlData );
 
   90  styleElement.firstChildElement().save( stream, 0 );
 
 
  100  docX.setContent( mXmlData );
 
  101  styleElement.appendChild( docX.documentElement() );
 
 
  106  if ( mLayer && mStyleOverridden )
 
 
  114    if ( mStyleOverridden )
 
  118    mStyleOverridden = 
true;
 
 
bool restoreOverrideStyle()
Restore the original store after a call to setOverrideStyle()
 
bool setOverrideStyle(const QString &styleDef)
Temporarily apply a different style to the layer.
 
void setOverrideStyle(const QString &style)
Temporarily apply a different style to the layer.
 
~QgsMapLayerStyleOverride()
 
void readXml(const QDomElement &styleElement)
Read style configuration (for project file reading)
 
void readFromLayer(QgsMapLayer *layer)
Store layer's active style information in the instance.
 
void clear()
Remove any stored style data (will get invalid)
 
void writeToLayer(QgsMapLayer *layer) const
Apply stored layer's style information to the layer.
 
bool isValid() const
Tell whether the style is valid (i.e. there is something stored in it)
 
void writeXml(QDomElement &styleElement) const
Write style configuration (for project file writing)
 
QString xmlData() const
Returns XML content of the style.
 
QgsMapLayerStyle()=default
construct invalid style
 
Base class for all map layer types.
 
virtual void exportNamedStyle(QDomDocument &doc, QString &errorMsg, const QgsReadWriteContext &context=QgsReadWriteContext(), QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories) const
Export the properties of this layer as named style in a QDomDocument.
 
virtual bool importNamedStyle(QDomDocument &doc, QString &errorMsg, QgsMapLayer::StyleCategories categories=QgsMapLayer::AllStyleCategories)
Import the properties of this layer from a QDomDocument.
 
QgsMapLayerStyleManager * styleManager() const
Gets access to the layer's style manager.
 
The class is used as a container of context for various read/write operations on other objects.
 
#define QgsDebugError(str)