[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [marble] src/lib/marble: Legend: allow no-icon scene items
From: Thibaut Gridel <tgridel () free ! fr>
Date: 2014-08-28 20:41:38
Message-ID: E1XN6Vm-0003XT-34 () scm ! kde ! org
[Download RAW message or body]
Git commit ca2deb0dcfbcead7297e35e8419ff33497cc4f8d by Thibaut Gridel.
Committed on 28/08/2014 at 20:33.
Pushed by tgridel into branch 'master'.
Legend: allow no-icon scene items
M +12 -12 src/lib/marble/MarbleLegendBrowser.cpp
M +1 -1 src/lib/marble/geodata/scene/GeoSceneIcon.cpp
http://commits.kde.org/marble/ca2deb0dcfbcead7297e35e8419ff33497cc4f8d
diff --git a/src/lib/marble/MarbleLegendBrowser.cpp \
b/src/lib/marble/MarbleLegendBrowser.cpp index 911d929..766e813 100644
--- a/src/lib/marble/MarbleLegendBrowser.cpp
+++ b/src/lib/marble/MarbleLegendBrowser.cpp
@@ -337,28 +337,28 @@ QString MarbleLegendBrowser::generateSectionsHtml()
}
// pixmap and text
- QString path = "";
+ QString src;
+ QString styleDiv;
int pixmapWidth = 24;
int pixmapHeight = 12;
- // NOTICE. There are some pixmaps without image, so we should
- // create just a plain rectangle with set color
if (!item->icon()->pixmap().isEmpty()) {
- path = MarbleDirs::path( item->icon()->pixmap() );
+ QString path = MarbleDirs::path( item->icon()->pixmap() );
const QPixmap oncePixmap(path);
pixmapWidth = oncePixmap.width();
pixmapHeight = oncePixmap.height();
+ src = QUrl::fromLocalFile( path ).toString();
+ styleDiv = "width: " + QString::number(pixmapWidth) + "px; height: " \
+ + QString::number(pixmapHeight) + "px;";
}
+
+
+ // NOTICE. There are some pixmaps without image, so we should
+ // create just a plain rectangle with set color
QColor color = item->icon()->color();
- QString styleDiv = "";
- if (color != Qt::transparent) {
+ if ( color.isValid() ) {
styleDiv = "width: " + QString::number(pixmapWidth) + "px; height: " \
+
- QString::number(pixmapHeight) + "px; \
background-color: "
- + color.name() + ';';
- } else {
- styleDiv = "width: " + QString::number(pixmapWidth) + "px; height: " \
+
- QString::number(pixmapHeight) + "px;";
+ QString::number(pixmapHeight) + "px; background-color: " + \
color.name() + ';'; }
- QString src = QUrl::fromLocalFile( path ).toString();
QString html = ""
"<div class=\"legend-entry\">"
" <label>" + checkBoxString +
diff --git a/src/lib/marble/geodata/scene/GeoSceneIcon.cpp \
b/src/lib/marble/geodata/scene/GeoSceneIcon.cpp index 812360b..d8acbed 100644
--- a/src/lib/marble/geodata/scene/GeoSceneIcon.cpp
+++ b/src/lib/marble/geodata/scene/GeoSceneIcon.cpp
@@ -26,7 +26,7 @@ namespace Marble
GeoSceneIcon::GeoSceneIcon()
: m_pixmap( "" ),
- m_color( "" )
+ m_color()
{
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic