[QGIS Commit] r12092 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Nov 11 14:52:51 EST 2009


Author: jef
Date: 2009-11-11 14:52:50 -0500 (Wed, 11 Nov 2009)
New Revision: 12092

Modified:
   trunk/qgis/src/core/qgsmaplayer.cpp
Log:
also store transparency setting in qml

Modified: trunk/qgis/src/core/qgsmaplayer.cpp
===================================================================
--- trunk/qgis/src/core/qgsmaplayer.cpp	2009-11-11 19:51:58 UTC (rev 12091)
+++ trunk/qgis/src/core/qgsmaplayer.cpp	2009-11-11 19:52:50 UTC (rev 12092)
@@ -586,6 +586,16 @@
   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 @@
   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 ) )
   {



More information about the QGIS-commit mailing list