summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-08 22:11:19 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-08 22:11:19 (GMT)
commit729a84e51e15a55187a066bd91aafe7cc516fb87 (patch)
tree4850b349a340a3b5045ad01c57bd79b941d5c2f5
parent567b7c1002e4525c6a843f568ce996ca36b7c85c (diff)
Fix: legends item either have a pixmap or a color, not both
-rw-r--r--src/lib/marble/MarbleLegendBrowser.cpp6
-rw-r--r--src/lib/marble/geodata/handlers/dgml/DgmlIconTagHandler.cpp7
-rw-r--r--src/lib/marble/geodata/writers/dgml/DgmlItemTagWriter.cpp2
3 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/marble/MarbleLegendBrowser.cpp b/src/lib/marble/MarbleLegendBrowser.cpp
index 77f8fc1..2310da2 100644
--- a/src/lib/marble/MarbleLegendBrowser.cpp
+++ b/src/lib/marble/MarbleLegendBrowser.cpp
@@ -354,12 +354,10 @@ QString MarbleLegendBrowser::generateSectionsHtml()
styleDiv = QLatin1String("width: ") + QString::number(pixmapWidth) + QLatin1String("px; height: ") +
QString::number(pixmapHeight) + QLatin1String("px;");
}
-
-
// NOTICE. There are some pixmaps without image, so we should
// create just a plain rectangle with set color
- QColor color = item->icon()->color();
- if ( color.isValid() ) {
+ else if (item->icon()->color().isValid()) {
+ const QColor color = item->icon()->color();
styleDiv = QLatin1String("width: ") + QString::number(pixmapWidth) + QLatin1String("px; height: ") +
QString::number(pixmapHeight) + QLatin1String("px; background-color: ") + color.name() + QLatin1Char(';');
}
diff --git a/src/lib/marble/geodata/handlers/dgml/DgmlIconTagHandler.cpp b/src/lib/marble/geodata/handlers/dgml/DgmlIconTagHandler.cpp
index 62d1944..2b92125 100644
--- a/src/lib/marble/geodata/handlers/dgml/DgmlIconTagHandler.cpp
+++ b/src/lib/marble/geodata/handlers/dgml/DgmlIconTagHandler.cpp
@@ -45,10 +45,11 @@ GeoNode* DgmlIconTagHandler::parse(GeoParser& parser) const
Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Icon)));
QString pixmapRelativePath = parser.attribute(dgmlAttr_pixmap).trimmed();
- QColor color = QColor( parser.attribute(dgmlAttr_color).trimmed() );
- if ( !color.isValid() )
- color = Qt::transparent;
+ QColor color;
+ if (pixmapRelativePath.isEmpty()) {
+ color.setNamedColor(parser.attribute(dgmlAttr_color).trimmed());
+ }
GeoSceneIcon *icon = 0;
diff --git a/src/lib/marble/geodata/writers/dgml/DgmlItemTagWriter.cpp b/src/lib/marble/geodata/writers/dgml/DgmlItemTagWriter.cpp
index b617253..ccee584 100644
--- a/src/lib/marble/geodata/writers/dgml/DgmlItemTagWriter.cpp
+++ b/src/lib/marble/geodata/writers/dgml/DgmlItemTagWriter.cpp
@@ -33,7 +33,7 @@ bool DgmlItemTagWriter::write(const GeoNode *node, GeoWriter& writer) const
writer.writeStartElement( dgml::dgmlTag_Icon );
if( !item->icon()->pixmap().isEmpty() ) {
writer.writeAttribute( "pixmap", item->icon()->pixmap() );
- } else if( !item->icon()->color().name().isEmpty() ) {
+ } else if (item->icon()->color().isValid()) {
writer.writeAttribute( "color", item->icon()->color().name() );
}
writer.writeEndElement();