Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
also store transparency setting in qml
git-svn-id: http://svn.osgeo.org/qgis/trunk@12092 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 11, 2009
1 parent 43b82f2 commit 255b21d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/core/qgsmaplayer.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 ) )
{
Expand Down

0 comments on commit 255b21d

Please sign in to comment.