Skip to content

Commit

Permalink
save categories that were used in the XML
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 4, 2018
1 parent 0787a73 commit b004a41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8884,6 +8884,7 @@ void QgisApp::copyStyle( QgsMapLayer *sourceLayer, QgsMapLayer::StyleCategories
}
// Copies data in text form as well, so the XML can be pasted into a text editor
clipboard()->setData( QGSCLIPBOARD_STYLE_MIME, doc.toByteArray(), doc.toString() );

// Enables the paste menu element
mActionPasteStyle->setEnabled( true );
}
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume
void QgsMapLayer::writeCommonStyle( QDomElement &layerElement, QDomDocument &document,
const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories ) const
{
// save categories
QMetaEnum metaEnum = QMetaEnum::fromType<QgsMapLayer::StyleCategories>();
QString categoriesKeys( metaEnum.valueToKeys( static_cast<int>( categories ) ) );
layerElement.setAttribute( QStringLiteral( "style_categories" ), categoriesKeys );

if ( categories.testFlag( Rendering ) )
{
// use scale dependent visibility flag
Expand Down

0 comments on commit b004a41

Please sign in to comment.