Skip to content
Permalink
Browse files

also store transparency setting in qml

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12092 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 11, 2009
1 parent d9162ac commit fb1a05f391b6229fd0c1dce9f10a401be226a42c
Showing with 17 additions and 0 deletions.
  1. +17 −0 src/core/qgsmaplayer.cpp
@@ -586,6 +586,16 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
setMinimumScale( myRoot.attribute( "minimumScale" ).toFloat() );
setMaximumScale( myRoot.attribute( "maximumScale" ).toFloat() );

//read transparency level
QDomNode transparencyNode = myRoot.namedItem( "transparencyLevelInt" );
if ( ! transparencyNode.isNull() )
{
// set transparency level only if it's in project
// (otherwise it sets the layer transparent)
QDomElement myElement = transparencyNode.toElement();
setTransparency( myElement.text().toInt() );
}

QString errorMsg;
theResultFlag = readSymbology( myRoot, errorMsg );
if ( !theResultFlag )
@@ -620,6 +630,13 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
myRootNode.setAttribute( "minimumScale", minimumScale() );
myRootNode.setAttribute( "maximumScale", maximumScale() );

// <transparencyLevelInt>
QDomElement transparencyLevelIntElement = myDocument.createElement( "transparencyLevelInt" );
QDomText transparencyLevelIntText = myDocument.createTextNode( QString::number( getTransparency() ) );
transparencyLevelIntElement.appendChild( transparencyLevelIntText );
myRootNode.appendChild( transparencyLevelIntElement );
// now append layer node to map layer node

QString errorMsg;
if ( !writeSymbology( myRootNode, myDocument, errorMsg ) )
{

0 comments on commit fb1a05f

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