Skip to content

Commit fb1a05f

Browse files
author
jef
committed
also store transparency setting in qml
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12092 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d9162ac commit fb1a05f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/core/qgsmaplayer.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,16 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
586586
setMinimumScale( myRoot.attribute( "minimumScale" ).toFloat() );
587587
setMaximumScale( myRoot.attribute( "maximumScale" ).toFloat() );
588588

589+
//read transparency level
590+
QDomNode transparencyNode = myRoot.namedItem( "transparencyLevelInt" );
591+
if ( ! transparencyNode.isNull() )
592+
{
593+
// set transparency level only if it's in project
594+
// (otherwise it sets the layer transparent)
595+
QDomElement myElement = transparencyNode.toElement();
596+
setTransparency( myElement.text().toInt() );
597+
}
598+
589599
QString errorMsg;
590600
theResultFlag = readSymbology( myRoot, errorMsg );
591601
if ( !theResultFlag )
@@ -620,6 +630,13 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
620630
myRootNode.setAttribute( "minimumScale", minimumScale() );
621631
myRootNode.setAttribute( "maximumScale", maximumScale() );
622632

633+
// <transparencyLevelInt>
634+
QDomElement transparencyLevelIntElement = myDocument.createElement( "transparencyLevelInt" );
635+
QDomText transparencyLevelIntText = myDocument.createTextNode( QString::number( getTransparency() ) );
636+
transparencyLevelIntElement.appendChild( transparencyLevelIntText );
637+
myRootNode.appendChild( transparencyLevelIntElement );
638+
// now append layer node to map layer node
639+
623640
QString errorMsg;
624641
if ( !writeSymbology( myRootNode, myDocument, errorMsg ) )
625642
{

0 commit comments

Comments
 (0)