@@ -586,6 +586,16 @@ QString QgsMapLayer::loadNamedStyle( const QString theURI, bool &theResultFlag )
586
586
setMinimumScale ( myRoot.attribute ( " minimumScale" ).toFloat () );
587
587
setMaximumScale ( myRoot.attribute ( " maximumScale" ).toFloat () );
588
588
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
+
589
599
QString errorMsg;
590
600
theResultFlag = readSymbology ( myRoot, errorMsg );
591
601
if ( !theResultFlag )
@@ -620,6 +630,13 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
620
630
myRootNode.setAttribute ( " minimumScale" , minimumScale () );
621
631
myRootNode.setAttribute ( " maximumScale" , maximumScale () );
622
632
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
+
623
640
QString errorMsg;
624
641
if ( !writeSymbology ( myRootNode, myDocument, errorMsg ) )
625
642
{
0 commit comments