From kde-commits Mon Jan 17 23:21:09 2011 From: Torsten Rahn Date: Mon, 17 Jan 2011 23:21:09 +0000 To: kde-commits Subject: branches/KDE/4.6/kdeedu/marble/src/plugins/render/mapscale Message-Id: <20110117232109.64603AC8B6 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129530652101148 SVN commit 1215188 by rahn: Backport: rahn * r1215182 trunk/KDE/kdeedu/marble/src/plugins/render/mapscale/MapScaleFloatItem.cpp - Hotfix for the mile 0-precision bug of the scale bar reported by Mustali Dalal: Unfortunately using "feet" instead of "miles" for low values is not trivial, so we use floating point representation for values close to 0. M +7 -0 MapScaleFloatItem.cpp --- branches/KDE/4.6/kdeedu/marble/src/plugins/render/mapscale/MapScaleFloatItem.cpp #1215187:1215188 @@ -193,7 +193,14 @@ else { m_unit = "mi"; intervalStr.setNum( j * m_valueInterval / 1000 ); + + if ( m_bestDivisor * m_valueInterval > 3800 ) { + intervalStr.setNum( j * m_valueInterval / 1000 ); } + else { + intervalStr.setNum( qreal(j * m_valueInterval ) / 1000.0, 'f', 2 ); + } + } painter->setFont( font() );