summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-10 20:49:03 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-09-10 20:49:03 (GMT)
commit881e5d0c8f8a614f2b36b41d8059690bb90c9648 (patch)
tree01c8b1b0de9dfae956865a9d570c6e39e7fe0bdc
parent5208de325ec74c6adc959957d32698d2dc01923f (diff)
Use localized values for display of EarthquakeItems
-rw-r--r--src/plugins/render/earthquake/EarthquakeItem.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/render/earthquake/EarthquakeItem.cpp b/src/plugins/render/earthquake/EarthquakeItem.cpp
index 78bf00f..952ad42 100644
--- a/src/plugins/render/earthquake/EarthquakeItem.cpp
+++ b/src/plugins/render/earthquake/EarthquakeItem.cpp
@@ -14,6 +14,7 @@
#include <QFontMetrics>
#include <QPainter>
#include <QSvgRenderer>
+#include <QLocale>
namespace Marble
{
@@ -87,7 +88,7 @@ void EarthquakeItem::paint( QPainter *painter )
// Draws magnitude of the earthquake
QFontMetrics metrics( s_font );
- QString magnitudeText = QString::number( magnitude() );
+ const QString magnitudeText = QLocale::system().toString(m_magnitude);
QRect magnitudeRect = metrics.boundingRect( magnitudeText );
painter->setBrush( QBrush() );
painter->setPen( QPen() );
@@ -122,12 +123,13 @@ void EarthquakeItem::setDepth( double depth )
void EarthquakeItem::updateTooltip()
{
+ QLocale locale = QLocale::system();
QString html = QLatin1String("<table cellpadding=\"2\">");
if ( m_dateTime.isValid() ) {
- html += QLatin1String("<tr><td align=\"right\">") + tr("Date:") + QLatin1String("</td><td>") + m_dateTime.toString(Qt::SystemLocaleShortDate) + QLatin1String("</td></tr>");
+ html += QLatin1String("<tr><td align=\"right\">") + tr("Date:") + QLatin1String("</td><td>") + locale.toString(m_dateTime, QLocale::ShortFormat) + QLatin1String("</td></tr>");
}
html +=
- QLatin1String("<tr><td align=\"right\">") + tr("Magnitude:") + QLatin1String("</td><td>") + QString::number(m_magnitude) + QLatin1String("</td></tr><tr><td align=\"right\">") + tr("Depth:") + QLatin1String("</td><td>") + QString::number(m_depth) + QLatin1String(" km</td></tr></table>");
+ QLatin1String("<tr><td align=\"right\">") + tr("Magnitude:") + QLatin1String("</td><td>") + locale.toString(m_magnitude) + QLatin1String("</td></tr><tr><td align=\"right\">") + tr("Depth:") + QLatin1String("</td><td>") + locale.toString(m_depth) + QLatin1String(" km</td></tr></table>");
setToolTip( html );
}