Skip to content

Commit 001bfb5

Browse files
author
mhugent
committed
Also use integer/double formating for continous color legend
git-svn-id: http://svn.osgeo.org/qgis/trunk@10991 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 047eb9d commit 001bfb5

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/app/qgscontinuouscolordialog.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "qgsvectordataprovider.h"
2626
#include "qgsvectorlayer.h"
2727
#include "qgslogger.h"
28+
#include <cmath>
2829

2930
#include <QColorDialog>
3031

@@ -136,7 +137,16 @@ void QgsContinuousColorDialog::apply()
136137

137138

138139
//create the render items for minimum and maximum value
139-
QgsSymbol* minsymbol = new QgsSymbol( mVectorLayer->geometryType(), QString::number( minimum, 'f' ), "", "" );
140+
QString minimumString;
141+
if(minimum - floor(minimum) > 0)
142+
{
143+
minimumString = QString::number( minimum, 'f' );
144+
}
145+
else
146+
{
147+
minimumString = QString::number( minimum );
148+
}
149+
QgsSymbol* minsymbol = new QgsSymbol( mVectorLayer->geometryType(), minimumString, "", "" );
140150
QPen minPen;
141151
minPen.setColor( btnMinValue->color() );
142152
minPen.setWidthF( outlinewidthspinbox->value() );
@@ -150,7 +160,16 @@ void QgsContinuousColorDialog::apply()
150160
minsymbol->setPen( minPen );
151161
}
152162

153-
QgsSymbol* maxsymbol = new QgsSymbol( mVectorLayer->geometryType(), QString::number( maximum, 'f' ), "", "" );
163+
QString maximumString;
164+
if(maximum - floor(maximum) > 0)
165+
{
166+
maximumString = QString::number( maximum, 'f' );
167+
}
168+
else
169+
{
170+
maximumString = QString::number( maximum );
171+
}
172+
QgsSymbol* maxsymbol = new QgsSymbol( mVectorLayer->geometryType(), maximumString, "", "" );
154173
QPen maxPen;
155174
maxPen.setColor( btnMaxValue->color() );
156175
maxPen.setWidthF( outlinewidthspinbox->value() );

0 commit comments

Comments
 (0)