@@ -157,7 +157,7 @@ QgsSvgCacheEntry* QgsSvgCache::insertSVG( const QString& file, double size, cons
157
157
}
158
158
159
159
void QgsSvgCache::containsParams ( const QString& path, bool & hasFillParam, QColor& defaultFillColor, bool & hasOutlineParam, QColor& defaultOutlineColor,
160
- bool & hasOutlineWidthParam, double & defaultOutlineWidth ) const
160
+ bool & hasOutlineWidthParam, double & defaultOutlineWidth ) const
161
161
{
162
162
/* hasFillParam = false;
163
163
hasOutlineParam = false;
@@ -191,7 +191,7 @@ void QgsSvgCache::containsParams( const QString& path, bool& hasFillParam, QColo
191
191
}*/
192
192
193
193
defaultFillColor = QColor ( Qt::black );
194
- defaultOutlineColor= QColor ( Qt::black );
194
+ defaultOutlineColor = QColor ( Qt::black );
195
195
defaultOutlineWidth = 1.0 ;
196
196
197
197
QFile svgFile ( path );
@@ -398,15 +398,15 @@ void QgsSvgCache::replaceElemParams( QDomElement& elem, const QColor& fill, cons
398
398
}
399
399
400
400
void QgsSvgCache::containsElemParams ( const QDomElement& elem, bool & hasFillParam, QColor& defaultFill, bool & hasOutlineParam, QColor& defaultOutline,
401
- bool & hasOutlineWidthParam, double & defaultOutlineWidth ) const
401
+ bool & hasOutlineWidthParam, double & defaultOutlineWidth ) const
402
402
{
403
- if ( elem.isNull () )
403
+ if ( elem.isNull () )
404
404
{
405
405
return ;
406
406
}
407
407
408
408
// we already have all the information, no need to go deeper
409
- if ( hasFillParam && hasOutlineParam && hasOutlineWidthParam )
409
+ if ( hasFillParam && hasOutlineParam && hasOutlineWidthParam )
410
410
{
411
411
return ;
412
412
}
@@ -426,27 +426,34 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
426
426
QStringList::const_iterator entryIt = entryList.constBegin ();
427
427
for ( ; entryIt != entryList.constEnd (); ++entryIt )
428
428
{
429
- valueSplit = entryIt->split (" " );
430
- if ( !hasFillParam && entryIt->startsWith ( " param(fill)" ) )
429
+ QStringList keyValueSplit = entryIt->split ( ' :' );
430
+ if ( keyValueSplit.size () < 2 )
431
+ {
432
+ continue ;
433
+ }
434
+ QString key = keyValueSplit.at ( 0 );
435
+ QString value = keyValueSplit.at ( 1 );
436
+ valueSplit = value.split ( " " );
437
+ if ( !hasFillParam && value.startsWith ( " param(fill)" ) )
431
438
{
432
439
hasFillParam = true ;
433
- if ( valueSplit.size () > 1 )
440
+ if ( valueSplit.size () > 1 )
434
441
{
435
442
defaultFill = QColor ( valueSplit.at ( 1 ) );
436
443
}
437
444
}
438
- else if ( !hasOutlineParam && entryIt-> startsWith ( " param(outline)" ) )
445
+ else if ( !hasOutlineParam && value. startsWith ( " param(outline)" ) )
439
446
{
440
447
hasOutlineParam = true ;
441
- if ( valueSplit.size () > 1 )
448
+ if ( valueSplit.size () > 1 )
442
449
{
443
450
defaultOutline = QColor ( valueSplit.at ( 1 ) );
444
451
}
445
452
}
446
- else if ( !hasOutlineWidthParam && entryIt-> startsWith ( " param(outlineWidth)" ) )
453
+ else if ( !hasOutlineWidthParam && value. startsWith ( " param(outlineWidth)" ) )
447
454
{
448
455
hasOutlineWidthParam = true ;
449
- if ( valueSplit.size () > 1 )
456
+ if ( valueSplit.size () > 1 )
450
457
{
451
458
defaultOutlineWidth = valueSplit.at ( 1 ).toDouble ();
452
459
}
@@ -456,27 +463,27 @@ void QgsSvgCache::containsElemParams( const QDomElement& elem, bool& hasFillPara
456
463
else
457
464
{
458
465
QString value = attribute.value ();
459
- valueSplit = value.split (" " );
466
+ valueSplit = value.split ( " " );
460
467
if ( !hasFillParam && value.startsWith ( " param(fill)" ) )
461
468
{
462
469
hasFillParam = true ;
463
- if ( valueSplit.size () > 1 )
470
+ if ( valueSplit.size () > 1 )
464
471
{
465
472
defaultFill = QColor ( valueSplit.at ( 1 ) );
466
473
}
467
474
}
468
- else if ( !hasOutlineParam && value.startsWith ( " param(outline)" ) )
475
+ else if ( !hasOutlineParam && value.startsWith ( " param(outline)" ) )
469
476
{
470
477
hasOutlineParam = true ;
471
- if ( valueSplit.size () > 1 )
478
+ if ( valueSplit.size () > 1 )
472
479
{
473
480
defaultOutline = QColor ( valueSplit.at ( 1 ) );
474
481
}
475
482
}
476
- else if ( !hasOutlineWidthParam && value.startsWith ( " param(outlineWidth)" ) )
483
+ else if ( !hasOutlineWidthParam && value.startsWith ( " param(outlineWidth)" ) )
477
484
{
478
485
hasOutlineWidthParam = true ;
479
- if ( valueSplit.size () > 1 )
486
+ if ( valueSplit.size () > 1 )
480
487
{
481
488
defaultOutlineWidth = valueSplit.at ( 1 ).toDouble ();
482
489
}
0 commit comments