@@ -337,6 +337,56 @@ bool QgsComposerShape::readXML( const QDomElement& itemElem, const QDomDocument&
337
337
}
338
338
properties.insert ( " color_border" , QgsSymbolLayerV2Utils::encodeColor ( pen ().color () ) );
339
339
properties.insert ( " width_border" , QString::number ( pen ().widthF () ) );
340
+
341
+ // for pre 2.0 projects, shape colour and outline were specified in a different element...
342
+ QDomNodeList outlineColorList = itemElem.elementsByTagName ( " OutlineColor" );
343
+ if ( outlineColorList.size () > 0 )
344
+ {
345
+ QDomElement frameColorElem = outlineColorList.at ( 0 ).toElement ();
346
+ bool redOk, greenOk, blueOk, alphaOk, widthOk;
347
+ int penRed, penGreen, penBlue, penAlpha;
348
+ double penWidth;
349
+
350
+ penWidth = itemElem.attribute ( " outlineWidth" ).toDouble ( &widthOk );
351
+ penRed = frameColorElem.attribute ( " red" ).toDouble ( &redOk );
352
+ penGreen = frameColorElem.attribute ( " green" ).toDouble ( &greenOk );
353
+ penBlue = frameColorElem.attribute ( " blue" ).toDouble ( &blueOk );
354
+ penAlpha = frameColorElem.attribute ( " alpha" ).toDouble ( &alphaOk );
355
+
356
+ if ( redOk && greenOk && blueOk && alphaOk && widthOk )
357
+ {
358
+ properties.insert ( " color_border" , QgsSymbolLayerV2Utils::encodeColor ( QColor ( penRed, penGreen, penBlue, penAlpha ) ) );
359
+ properties.insert ( " width_border" , QString::number ( penWidth ) );
360
+ }
361
+ }
362
+ QDomNodeList fillColorList = itemElem.elementsByTagName ( " FillColor" );
363
+ if ( fillColorList.size () > 0 )
364
+ {
365
+ QDomElement fillColorElem = fillColorList.at ( 0 ).toElement ();
366
+ bool redOk, greenOk, blueOk, alphaOk;
367
+ int fillRed, fillGreen, fillBlue, fillAlpha;
368
+
369
+ fillRed = fillColorElem.attribute ( " red" ).toDouble ( &redOk );
370
+ fillGreen = fillColorElem.attribute ( " green" ).toDouble ( &greenOk );
371
+ fillBlue = fillColorElem.attribute ( " blue" ).toDouble ( &blueOk );
372
+ fillAlpha = fillColorElem.attribute ( " alpha" ).toDouble ( &alphaOk );
373
+
374
+ if ( redOk && greenOk && blueOk && alphaOk )
375
+ {
376
+ properties.insert ( " color" , QgsSymbolLayerV2Utils::encodeColor ( QColor ( fillRed, fillGreen, fillBlue, fillAlpha ) ) );
377
+ properties.insert ( " style" , " solid" );
378
+ }
379
+ }
380
+ if ( itemElem.hasAttribute ( " transparentFill" ) )
381
+ {
382
+ // old style (pre 2.0) of specifying that shapes had no fill
383
+ bool hasOldTransparentFill = itemElem.attribute ( " transparentFill" , " 0" ).toInt ();
384
+ if ( hasOldTransparentFill )
385
+ {
386
+ properties.insert ( " style" , " no" );
387
+ }
388
+ }
389
+
340
390
mShapeStyleSymbol = QgsFillSymbolV2::createSimple ( properties );
341
391
}
342
392
emit itemChanged ();
0 commit comments