summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-17 15:59:26 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-24 17:57:46 (GMT)
commit61da9616b85a53203a11417c96ff0028d6d4880b (patch)
tree748784fff806317a1e68e133991316ccd3c69b98
parentc888313dbc82487619862e1e80664d4bded9791e (diff)
CompassFloatItem: avoid multiple assignment, "" -> QString()
-rw-r--r--src/plugins/render/compass/CompassFloatItem.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/plugins/render/compass/CompassFloatItem.cpp b/src/plugins/render/compass/CompassFloatItem.cpp
index c7b8aed..a94a8c0 100644
--- a/src/plugins/render/compass/CompassFloatItem.cpp
+++ b/src/plugins/render/compass/CompassFloatItem.cpp
@@ -140,11 +140,10 @@ void CompassFloatItem::paintContent( QPainter *painter )
QRectF compassRect( contentRect() );
- QString dirstr = tr( "N" );
- if ( m_polarity == -1 )
- dirstr = tr( "S" );
- if ( m_polarity == 0 )
- dirstr = "";
+ const QString dirstr =
+ (m_polarity == +1) ? tr("N") :
+ (m_polarity == -1) ? tr("S") :
+ /*else*/ QString();
int fontheight = QFontMetrics( font() ).ascent();
int fontwidth = QFontMetrics( font() ).boundingRect( dirstr ).width();