Skip to content

Instantly share code, notes, and snippets.

@jef-n jef-n/gist:2895431
Created Jun 8, 2012

Embed
What would you like to do?
don't use QDomElement::setAttribute's float and double versions
diff --git a/src/core/composer/qgscomposerarrow.cpp b/src/core/composer/qgscomposerarrow.cpp
index c167af8..94672c0 100644
--- a/src/core/composer/qgscomposerarrow.cpp
+++ b/src/core/composer/qgscomposerarrow.cpp
@@ -284,8 +284,8 @@ void QgsComposerArrow::adaptItemSceneRect()
bool QgsComposerArrow::writeXML( QDomElement& elem, QDomDocument & doc ) const
{
QDomElement composerArrowElem = doc.createElement( "ComposerArrow" );
- composerArrowElem.setAttribute( "outlineWidth", outlineWidth() );
- composerArrowElem.setAttribute( "arrowHeadWidth", mArrowHeadWidth );
+ composerArrowElem.setAttribute( "outlineWidth", QString::number( outlineWidth() ) );
+ composerArrowElem.setAttribute( "arrowHeadWidth", QString::number( mArrowHeadWidth ) );
composerArrowElem.setAttribute( "markerMode", mMarkerMode );
composerArrowElem.setAttribute( "startMarkerFile", mStartMarkerFile );
composerArrowElem.setAttribute( "endMarkerFile", mEndMarkerFile );
@@ -300,14 +300,14 @@ bool QgsComposerArrow::writeXML( QDomElement& elem, QDomDocument & doc ) const
//start point
QDomElement startPointElem = doc.createElement( "StartPoint" );
- startPointElem.setAttribute( "x", mStartPoint.x() );
- startPointElem.setAttribute( "y", mStartPoint.y() );
+ startPointElem.setAttribute( "x", QString::number( mStartPoint.x() ) );
+ startPointElem.setAttribute( "y", QString::number( mStartPoint.y() ) );
composerArrowElem.appendChild( startPointElem );
//stop point
QDomElement stopPointElem = doc.createElement( "StopPoint" );
- stopPointElem.setAttribute( "x", mStopPoint.x() );
- stopPointElem.setAttribute( "y", mStopPoint.y() );
+ stopPointElem.setAttribute( "x", QString::number( mStopPoint.x() ) );
+ stopPointElem.setAttribute( "y", QString::number( mStopPoint.y() ) );
composerArrowElem.appendChild( stopPointElem );
elem.appendChild( composerArrowElem );
diff --git a/src/core/composer/qgscomposeritem.cpp b/src/core/composer/qgscomposeritem.cpp
index 5b66b2e..29b284e 100644
--- a/src/core/composer/qgscomposeritem.cpp
+++ b/src/core/composer/qgscomposeritem.cpp
@@ -124,13 +124,13 @@ bool QgsComposerItem::_writeXML( QDomElement& itemElem, QDomDocument& doc ) cons
}
//scene rect
- composerItemElem.setAttribute( "x", transform().dx() );
- composerItemElem.setAttribute( "y", transform().dy() );
- composerItemElem.setAttribute( "width", rect().width() );
- composerItemElem.setAttribute( "height", rect().height() );
+ composerItemElem.setAttribute( "x", QString::number( transform().dx() ) );
+ composerItemElem.setAttribute( "y", QString::number( transform().dy() ) );
+ composerItemElem.setAttribute( "width", QString::number( rect().width() ) );
+ composerItemElem.setAttribute( "height", QString::number( rect().height() ) );
composerItemElem.setAttribute( "zValue", QString::number( zValue() ) );
composerItemElem.setAttribute( "outlineWidth", QString::number( pen().widthF() ) );
- composerItemElem.setAttribute( "rotation", mRotation );
+ composerItemElem.setAttribute( "rotation", QString::number( mRotation ) );
composerItemElem.setAttribute( "id", mId );
//position lock for mouse moves/resizes
if ( mItemPositionLocked )
@@ -142,7 +142,7 @@ bool QgsComposerItem::_writeXML( QDomElement& itemElem, QDomDocument& doc ) cons
composerItemElem.setAttribute( "positionLock", "false" );
}
- composerItemElem.setAttribute( "lastValidViewScaleFactor", mLastValidViewScaleFactor );
+ composerItemElem.setAttribute( "lastValidViewScaleFactor", QString::number( mLastValidViewScaleFactor ) );
//frame color
diff --git a/src/core/composer/qgscomposerlegend.cpp b/src/core/composer/qgscomposerlegend.cpp
index a222ea4..fad7f7e 100644
--- a/src/core/composer/qgscomposerlegend.cpp
+++ b/src/core/composer/qgscomposerlegend.cpp
@@ -681,8 +681,8 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const
composerLegendElem.setAttribute( "layerSpace", QString::number( mLayerSpace ) );
composerLegendElem.setAttribute( "symbolSpace", QString::number( mSymbolSpace ) );
composerLegendElem.setAttribute( "iconLabelSpace", QString::number( mIconLabelSpace ) );
- composerLegendElem.setAttribute( "symbolWidth", mSymbolWidth );
- composerLegendElem.setAttribute( "symbolHeight", mSymbolHeight );
+ composerLegendElem.setAttribute( "symbolWidth", QString::number( mSymbolWidth ) );
+ composerLegendElem.setAttribute( "symbolHeight", QString::number( mSymbolHeight ) );
composerLegendElem.setAttribute( "wrapChar", mWrapChar );
if ( mComposerMap )
diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp
index be124bc..c43049b 100644
--- a/src/core/composer/qgscomposermap.cpp
+++ b/src/core/composer/qgscomposermap.cpp
@@ -659,10 +659,10 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
//extent
QDomElement extentElem = doc.createElement( "Extent" );
- extentElem.setAttribute( "xmin", mExtent.xMinimum() );
- extentElem.setAttribute( "xmax", mExtent.xMaximum() );
- extentElem.setAttribute( "ymin", mExtent.yMinimum() );
- extentElem.setAttribute( "ymax", mExtent.yMaximum() );
+ extentElem.setAttribute( "xmin", QString::number( mExtent.xMinimum() ) );
+ extentElem.setAttribute( "xmax", QString::number( mExtent.xMaximum() ) );
+ extentElem.setAttribute( "ymin", QString::number( mExtent.yMinimum() ) );
+ extentElem.setAttribute( "ymax", QString::number( mExtent.yMaximum() ) );
composerMapElem.appendChild( extentElem );
//layer set
@@ -681,21 +681,21 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
QDomElement gridElem = doc.createElement( "Grid" );
gridElem.setAttribute( "show", mGridEnabled );
gridElem.setAttribute( "gridStyle", mGridStyle );
- gridElem.setAttribute( "intervalX", mGridIntervalX );
- gridElem.setAttribute( "intervalY", mGridIntervalY );
- gridElem.setAttribute( "offsetX", mGridOffsetX );
- gridElem.setAttribute( "offsetY", mGridOffsetY );
- gridElem.setAttribute( "penWidth", mGridPen.widthF() );
+ gridElem.setAttribute( "intervalX", QString::number( mGridIntervalX ) );
+ gridElem.setAttribute( "intervalY", QString::number( mGridIntervalY ) );
+ gridElem.setAttribute( "offsetX", QString::number( mGridOffsetX ) );
+ gridElem.setAttribute( "offsetY", QString::number( mGridOffsetY ) );
+ gridElem.setAttribute( "penWidth", QString::number( mGridPen.widthF() ) );
gridElem.setAttribute( "penColorRed", mGridPen.color().red() );
gridElem.setAttribute( "penColorGreen", mGridPen.color().green() );
gridElem.setAttribute( "penColorBlue", mGridPen.color().blue() );
- gridElem.setAttribute( "crossLength", mCrossLength );
+ gridElem.setAttribute( "crossLength", QString::number( mCrossLength ) );
//grid annotation
QDomElement annotationElem = doc.createElement( "Annotation" );
annotationElem.setAttribute( "show", mShowGridAnnotation );
annotationElem.setAttribute( "position", mGridAnnotationPosition );
- annotationElem.setAttribute( "frameDistance", mAnnotationFrameDistance );
+ annotationElem.setAttribute( "frameDistance", QString::number( mAnnotationFrameDistance ) );
annotationElem.setAttribute( "direction", mGridAnnotationDirection );
annotationElem.setAttribute( "font", mGridAnnotationFont.toString() );
annotationElem.setAttribute( "precision", mGridAnnotationPrecision );
diff --git a/src/core/composer/qgscomposerpicture.cpp b/src/core/composer/qgscomposerpicture.cpp
index 0dc7b8c..8b9a5af 100644
--- a/src/core/composer/qgscomposerpicture.cpp
+++ b/src/core/composer/qgscomposerpicture.cpp
@@ -268,8 +268,8 @@ bool QgsComposerPicture::writeXML( QDomElement& elem, QDomDocument & doc ) const
}
QDomElement composerPictureElem = doc.createElement( "ComposerPicture" );
composerPictureElem.setAttribute( "file", QgsProject::instance()->writePath( mSourceFile.fileName() ) );
- composerPictureElem.setAttribute( "pictureWidth", mPictureWidth );
- composerPictureElem.setAttribute( "pictureHeight", mPictureHeight );
+ composerPictureElem.setAttribute( "pictureWidth", QString::number( mPictureWidth ) );
+ composerPictureElem.setAttribute( "pictureHeight", QString::number( mPictureHeight ) );
if ( !mRotationMap )
{
composerPictureElem.setAttribute( "mapId", -1 );
diff --git a/src/core/composer/qgscomposerscalebar.cpp b/src/core/composer/qgscomposerscalebar.cpp
index 46c2766..0082062 100644
--- a/src/core/composer/qgscomposerscalebar.cpp
+++ b/src/core/composer/qgscomposerscalebar.cpp
@@ -347,16 +347,16 @@ bool QgsComposerScaleBar::writeXML( QDomElement& elem, QDomDocument & doc ) cons
}
QDomElement composerScaleBarElem = doc.createElement( "ComposerScaleBar" );
- composerScaleBarElem.setAttribute( "height", mHeight );
- composerScaleBarElem.setAttribute( "labelBarSpace", mLabelBarSpace );
- composerScaleBarElem.setAttribute( "boxContentSpace", mBoxContentSpace );
+ composerScaleBarElem.setAttribute( "height", QString::number( mHeight ) );
+ composerScaleBarElem.setAttribute( "labelBarSpace", QString::number( mLabelBarSpace ) );
+ composerScaleBarElem.setAttribute( "boxContentSpace", QString::number( mBoxContentSpace ) );
composerScaleBarElem.setAttribute( "numSegments", mNumSegments );
composerScaleBarElem.setAttribute( "numSegmentsLeft", mNumSegmentsLeft );
- composerScaleBarElem.setAttribute( "numUnitsPerSegment", mNumUnitsPerSegment );
- composerScaleBarElem.setAttribute( "segmentMillimeters", mSegmentMillimeters );
- composerScaleBarElem.setAttribute( "numMapUnitsPerScaleBarUnit", mNumMapUnitsPerScaleBarUnit );
+ composerScaleBarElem.setAttribute( "numUnitsPerSegment", QString::number( mNumUnitsPerSegment ) );
+ composerScaleBarElem.setAttribute( "segmentMillimeters", QString::number( mSegmentMillimeters ) );
+ composerScaleBarElem.setAttribute( "numMapUnitsPerScaleBarUnit", QString::number( mNumMapUnitsPerScaleBarUnit ) );
composerScaleBarElem.setAttribute( "font", mFont.toString() );
- composerScaleBarElem.setAttribute( "outlineWidth", mPen.widthF() );
+ composerScaleBarElem.setAttribute( "outlineWidth", QString::number( mPen.widthF() ) );
composerScaleBarElem.setAttribute( "unitLabel", mUnitLabeling );
//style
diff --git a/src/core/composer/qgscomposershape.cpp b/src/core/composer/qgscomposershape.cpp
index d0cb178..b5e576d 100644
--- a/src/core/composer/qgscomposershape.cpp
+++ b/src/core/composer/qgscomposershape.cpp
@@ -87,10 +87,10 @@ bool QgsComposerShape::writeXML( QDomElement& elem, QDomDocument & doc ) const
{
QDomElement composerShapeElem = doc.createElement( "ComposerShape" );
composerShapeElem.setAttribute( "shapeType", mShape );
- composerShapeElem.setAttribute( "outlineWidth", mPen.widthF() );
+ composerShapeElem.setAttribute( "outlineWidth", QString::number( mPen.widthF() ) );
composerShapeElem.setAttribute( "transparentFill", mBrush.style() == Qt::NoBrush );
- composerShapeElem.setAttribute( "shapeWidth", mShapeWidth );
- composerShapeElem.setAttribute( "shapeHeight", mShapeHeight );
+ composerShapeElem.setAttribute( "shapeWidth", QString::number( mShapeWidth ) );
+ composerShapeElem.setAttribute( "shapeHeight", QString::number( mShapeHeight ) );
QDomElement outlineColorElem = doc.createElement( "OutlineColor" );
outlineColorElem.setAttribute( "red", mPen.color().red() );
outlineColorElem.setAttribute( "green", mPen.color().green() );
diff --git a/src/core/composer/qgscomposertable.cpp b/src/core/composer/qgscomposertable.cpp
index 81be29f..6f27a03 100644
--- a/src/core/composer/qgscomposertable.cpp
+++ b/src/core/composer/qgscomposertable.cpp
@@ -134,10 +134,10 @@ void QgsComposerTable::adjustFrameToSize()
bool QgsComposerTable::tableWriteXML( QDomElement& elem, QDomDocument & doc ) const
{
- elem.setAttribute( "lineTextDist", mLineTextDistance );
+ elem.setAttribute( "lineTextDist", QString::number( mLineTextDistance ) );
elem.setAttribute( "headerFont", mHeaderFont.toString() );
elem.setAttribute( "contentFont", mContentFont.toString() );
- elem.setAttribute( "gridStrokeWidth", mGridStrokeWidth );
+ elem.setAttribute( "gridStrokeWidth", QString::number( mGridStrokeWidth ) );
elem.setAttribute( "gridColorRed", mGridColor.red() );
elem.setAttribute( "gridColorGreen", mGridColor.green() );
elem.setAttribute( "gridColorBlue", mGridColor.blue() );
diff --git a/src/core/composer/qgscomposition.cpp b/src/core/composer/qgscomposition.cpp
index 218e9f7..4cfa28e 100644
--- a/src/core/composer/qgscomposition.cpp
+++ b/src/core/composer/qgscomposition.cpp
@@ -189,8 +189,8 @@ bool QgsComposition::writeXML( QDomElement& composerElem, QDomDocument& doc )
QDomElement compositionElem = doc.createElement( "Composition" );
if ( mPaperItem )
{
- compositionElem.setAttribute( "paperWidth", mPaperItem->rect().width() );
- compositionElem.setAttribute( "paperHeight", mPaperItem->rect().height() );
+ compositionElem.setAttribute( "paperWidth", QString::number( mPaperItem->rect().width() ) );
+ compositionElem.setAttribute( "paperHeight", QString::number( mPaperItem->rect().height() ) );
}
//snapping
@@ -202,9 +202,9 @@ bool QgsComposition::writeXML( QDomElement& composerElem, QDomDocument& doc )
{
compositionElem.setAttribute( "snapping", "0" );
}
- compositionElem.setAttribute( "snapGridResolution", mSnapGridResolution );
- compositionElem.setAttribute( "snapGridOffsetX", mSnapGridOffsetX );
- compositionElem.setAttribute( "snapGridOffsetY", mSnapGridOffsetY );
+ compositionElem.setAttribute( "snapGridResolution", QString::number( mSnapGridResolution ) );
+ compositionElem.setAttribute( "snapGridOffsetX", QString::number( mSnapGridOffsetX ) );
+ compositionElem.setAttribute( "snapGridOffsetY", QString::number( mSnapGridOffsetY ) );
compositionElem.setAttribute( "printResolution", mPrintResolution );
compositionElem.setAttribute( "printAsRaster", mPrintAsRaster );
diff --git a/src/core/qgsdiagramrendererv2.cpp b/src/core/qgsdiagramrendererv2.cpp
index 25ded43..36c2ff6 100644
--- a/src/core/qgsdiagramrendererv2.cpp
+++ b/src/core/qgsdiagramrendererv2.cpp
@@ -37,7 +37,7 @@ void QgsDiagramLayerSettings::writeXML( QDomElement& layerElem, QDomDocument& do
diagramLayerElem.setAttribute( "linePlacementFlags", placementFlags );
diagramLayerElem.setAttribute( "priority", priority );
diagramLayerElem.setAttribute( "obstacle", obstacle );
- diagramLayerElem.setAttribute( "dist", dist );
+ diagramLayerElem.setAttribute( "dist", QString::number( dist ) );
diagramLayerElem.setAttribute( "xPosColumn", xPosColumn );
diagramLayerElem.setAttribute( "yPosColumn", yPosColumn );
layerElem.appendChild( diagramLayerElem );
@@ -90,12 +90,12 @@ void QgsDiagramSettings::writeXML( QDomElement& rendererElem, QDomDocument& doc
categoryElem.setAttribute( "font", font.toString() );
categoryElem.setAttribute( "backgroundColor", backgroundColor.name() );
categoryElem.setAttribute( "backgroundAlpha", backgroundColor.alpha() );
- categoryElem.setAttribute( "width", size.width() );
- categoryElem.setAttribute( "height", size.height() );
+ categoryElem.setAttribute( "width", QString::number( size.width() ) );
+ categoryElem.setAttribute( "height", QString::number( size.height() ) );
categoryElem.setAttribute( "penColor", penColor.name() );
- categoryElem.setAttribute( "penWidth", penWidth );
- categoryElem.setAttribute( "minScaleDenominator", minScaleDenominator );
- categoryElem.setAttribute( "maxScaleDenominator", maxScaleDenominator );
+ categoryElem.setAttribute( "penWidth", QString::number( penWidth ) );
+ categoryElem.setAttribute( "minScaleDenominator", QString::number( minScaleDenominator ) );
+ categoryElem.setAttribute( "maxScaleDenominator", QString::number( maxScaleDenominator ) );
if ( sizeType == MM )
{
categoryElem.setAttribute( "sizeType", "MM" );
@@ -346,12 +346,12 @@ void QgsLinearlyInterpolatedDiagramRenderer::readXML( const QDomElement& elem )
void QgsLinearlyInterpolatedDiagramRenderer::writeXML( QDomElement& layerElem, QDomDocument& doc ) const
{
QDomElement rendererElem = doc.createElement( "LinearlyInterpolatedDiagramRenderer" );
- rendererElem.setAttribute( "lowerValue", mLowerValue );
- rendererElem.setAttribute( "upperValue", mUpperValue );
- rendererElem.setAttribute( "lowerWidth", mLowerSize.width() );
- rendererElem.setAttribute( "lowerHeight", mLowerSize.height() );
- rendererElem.setAttribute( "upperWidth", mUpperSize.width() );
- rendererElem.setAttribute( "upperHeight", mUpperSize.height() );
+ rendererElem.setAttribute( "lowerValue", QString::number( mLowerValue ) );
+ rendererElem.setAttribute( "upperValue", QString::number( mUpperValue ) );
+ rendererElem.setAttribute( "lowerWidth", QString::number( mLowerSize.width() ) );
+ rendererElem.setAttribute( "lowerHeight", QString::number( mLowerSize.height() ) );
+ rendererElem.setAttribute( "upperWidth", QString::number( mUpperSize.width() ) );
+ rendererElem.setAttribute( "upperHeight", QString::number( mUpperSize.height() ) );
rendererElem.setAttribute( "classificationAttribute", mClassificationAttribute );
mSettings.writeXML( rendererElem, doc );
_writeXML( rendererElem, doc );
diff --git a/src/core/qgslabel.cpp b/src/core/qgslabel.cpp
index 054f688..6a2db49 100644
--- a/src/core/qgslabel.cpp
+++ b/src/core/qgslabel.cpp
@@ -1077,7 +1077,7 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
// size and units
QDomElement size = document.createElement( "size" );
- size.setAttribute( "value", mLabelAttributes->size() );
+ size.setAttribute( "value", QString::number( mLabelAttributes->size() ) );
if ( mLabelAttributes->sizeIsSet() )
{
if ( mLabelFieldIdx[Size] != -1 )
@@ -1244,9 +1244,9 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
{
QDomElement offset = document.createElement( "offset" );
offset.setAttribute( "units", QgsLabelAttributes::unitsName( mLabelAttributes->offsetType() ) );
- offset.setAttribute( "x", mLabelAttributes->xOffset() );
+ offset.setAttribute( "x", QString::number( mLabelAttributes->xOffset() ) );
offset.setAttribute( "xfieldname", labelField( XOffset ) );
- offset.setAttribute( "y", mLabelAttributes->yOffset() );
+ offset.setAttribute( "y", QString::number( mLabelAttributes->yOffset() ) );
offset.setAttribute( "yfieldname", labelField( YOffset ) );
labelattributes.appendChild( offset );
}
@@ -1255,7 +1255,7 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
QDomElement angle = document.createElement( "angle" );
if ( mLabelAttributes->angleIsSet() )
{
- angle.setAttribute( "value", mLabelAttributes->angle() );
+ angle.setAttribute( "value", QString::number( mLabelAttributes->angle() ) );
if ( mLabelFieldIdx[Angle] != -1 )
{
angle.setAttribute( "fieldname", labelField( Angle ) );
@@ -1311,7 +1311,7 @@ void QgsLabel::writeXML( QDomNode & layer_node, QDomDocument & document ) const
QDomElement buffersize = document.createElement( "buffersize" );
if ( mLabelAttributes->bufferSizeIsSet() )
{
- buffersize.setAttribute( "value", mLabelAttributes->bufferSize() );
+ buffersize.setAttribute( "value", QString::number( mLabelAttributes->bufferSize() ) );
buffersize.setAttribute( "units", QgsLabelAttributes::unitsName( mLabelAttributes->bufferSizeType() ) );
if ( mLabelFieldIdx[BufferSize] != -1 )
{
diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp
index 6f4d2e3..fe00609 100644
--- a/src/core/qgsmaplayer.cpp
+++ b/src/core/qgsmaplayer.cpp
@@ -302,8 +302,8 @@ bool QgsMapLayer::writeXML( QDomNode & layer_node, QDomDocument & document )
// use scale dependent visibility flag
maplayer.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
- maplayer.setAttribute( "minimumScale", minimumScale() );
- maplayer.setAttribute( "maximumScale", maximumScale() );
+ maplayer.setAttribute( "minimumScale", QString::number( minimumScale() ) );
+ maplayer.setAttribute( "maximumScale", QString::number( maximumScale() ) );
// ID
QDomElement layerId = document.createElement( "id" );
@@ -745,8 +745,8 @@ QString QgsMapLayer::saveNamedStyle( const QString theURI, bool & theResultFlag
// use scale dependent visibility flag
myRootNode.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
- myRootNode.setAttribute( "minimumScale", minimumScale() );
- myRootNode.setAttribute( "maximumScale", maximumScale() );
+ myRootNode.setAttribute( "minimumScale", QString::number( minimumScale() ) );
+ myRootNode.setAttribute( "maximumScale", QString::number( maximumScale() ) );
// <transparencyLevelInt>
QDomElement transparencyLevelIntElement = myDocument.createElement( "transparencyLevelInt" );
diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp
index 851b4d6..f2589c3 100644
--- a/src/core/qgsvectorlayer.cpp
+++ b/src/core/qgsvectorlayer.cpp
@@ -3219,8 +3219,8 @@ bool QgsVectorLayer::writeSymbology( QDomNode& node, QDomDocument& doc, QString&
{
// use scale dependent visibility flag
mapLayerNode.setAttribute( "scaleBasedLabelVisibilityFlag", mLabel->scaleBasedVisibility() ? 1 : 0 );
- mapLayerNode.setAttribute( "minLabelScale", mLabel->minScale() );
- mapLayerNode.setAttribute( "maxLabelScale", mLabel->maxScale() );
+ mapLayerNode.setAttribute( "minLabelScale", QString::number( mLabel->minScale() ) );
+ mapLayerNode.setAttribute( "maxLabelScale", QString::number( mLabel->maxScale() ) );
//classification field(s)
QgsAttributeList attributes = mRenderer->classificationAttributes();
diff --git a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
index 877f564..9cd230d 100644
--- a/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
+++ b/src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
@@ -948,8 +948,8 @@ QDomElement QgsGraduatedSymbolRendererV2::save( QDomDocument& doc )
symbols.insert( symbolName, range.symbol() );
QDomElement rangeElem = doc.createElement( "range" );
- rangeElem.setAttribute( "lower", range.lowerValue() );
- rangeElem.setAttribute( "upper", range.upperValue() );
+ rangeElem.setAttribute( "lower", QString::number( range.lowerValue() ) );
+ rangeElem.setAttribute( "upper", QString::number( range.upperValue() ) );
rangeElem.setAttribute( "symbol", symbolName );
rangeElem.setAttribute( "label", range.label() );
rangesElem.appendChild( rangeElem );
diff --git a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
index affcddd..0c18c7b 100644
--- a/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
+++ b/src/core/symbology-ng/qgspointdisplacementrenderer.cpp
@@ -302,11 +302,11 @@ QDomElement QgsPointDisplacementRenderer::save( QDomDocument& doc )
rendererElement.setAttribute( "type", "pointDisplacement" );
rendererElement.setAttribute( "labelAttributeName", mLabelAttributeName );
rendererElement.setAttribute( "labelFont", mLabelFont.toString() );
- rendererElement.setAttribute( "circleWidth", mCircleWidth );
+ rendererElement.setAttribute( "circleWidth", QString::number( mCircleWidth ) );
rendererElement.setAttribute( "circleColor", QgsSymbolLayerV2Utils::encodeColor( mCircleColor ) );
rendererElement.setAttribute( "labelColor", QgsSymbolLayerV2Utils::encodeColor( mLabelColor ) );
- rendererElement.setAttribute( "circleRadiusAddition", mCircleRadiusAddition );
- rendererElement.setAttribute( "maxLabelScaleDenominator", mMaxLabelScaleDenominator );
+ rendererElement.setAttribute( "circleRadiusAddition", QString::number( mCircleRadiusAddition ) );
+ rendererElement.setAttribute( "maxLabelScaleDenominator", QString::number( mMaxLabelScaleDenominator ) );
if ( mRenderer )
{
diff --git a/src/core/symbology-ng/qgssymbollayerv2utils.cpp b/src/core/symbology-ng/qgssymbollayerv2utils.cpp
index 89074e4..38d1ad3 100644
--- a/src/core/symbology-ng/qgssymbollayerv2utils.cpp
+++ b/src/core/symbology-ng/qgssymbollayerv2utils.cpp
@@ -713,7 +713,7 @@ QDomElement QgsSymbolLayerV2Utils::saveSymbol( QString name, QgsSymbolV2* symbol
symEl.setAttribute( "type", _nameForSymbolType( symbol->type() ) );
symEl.setAttribute( "name", name );
symEl.setAttribute( "outputUnit", encodeOutputUnit( symbol->outputUnit() ) );
- symEl.setAttribute( "alpha", symbol->alpha() );
+ symEl.setAttribute( "alpha", QString::number( symbol->alpha() ) );
QgsDebugMsg( "num layers " + QString::number( symbol->symbolLayerCount() ) );
for ( int i = 0; i < symbol->symbolLayerCount(); i++ )
{
diff --git a/src/gui/qgsannotationitem.cpp b/src/gui/qgsannotationitem.cpp
index ee0b8ad..a3f5192 100644
--- a/src/gui/qgsannotationitem.cpp
+++ b/src/gui/qgsannotationitem.cpp
@@ -386,16 +386,16 @@ void QgsAnnotationItem::_writeXML( QDomDocument& doc, QDomElement& itemElem ) co
}
QDomElement annotationElem = doc.createElement( "AnnotationItem" );
annotationElem.setAttribute( "mapPositionFixed", mMapPositionFixed );
- annotationElem.setAttribute( "mapPosX", mMapPosition.x() );
- annotationElem.setAttribute( "mapPosY", mMapPosition.y() );
- annotationElem.setAttribute( "offsetX", mOffsetFromReferencePoint.x() );
- annotationElem.setAttribute( "offsetY", mOffsetFromReferencePoint.y() );
- annotationElem.setAttribute( "frameWidth", mFrameSize.width() );
- annotationElem.setAttribute( "frameHeight", mFrameSize.height() );
+ annotationElem.setAttribute( "mapPosX", QString::number( mMapPosition.x() ) );
+ annotationElem.setAttribute( "mapPosY", QString::number( mMapPosition.y() ) );
+ annotationElem.setAttribute( "offsetX", QString::number( mOffsetFromReferencePoint.x() ) );
+ annotationElem.setAttribute( "offsetY", QString::number( mOffsetFromReferencePoint.y() ) );
+ annotationElem.setAttribute( "frameWidth", QString::number( mFrameSize.width() ) );
+ annotationElem.setAttribute( "frameHeight", QString::number( mFrameSize.height() ) );
QPointF canvasPos = pos();
- annotationElem.setAttribute( "canvasPosX", canvasPos.x() );
- annotationElem.setAttribute( "canvasPosY", canvasPos.y() );
- annotationElem.setAttribute( "frameBorderWidth", mFrameBorderWidth );
+ annotationElem.setAttribute( "canvasPosX", QString::number( canvasPos.x() ) );
+ annotationElem.setAttribute( "canvasPosY", QString::number( canvasPos.y() ) );
+ annotationElem.setAttribute( "frameBorderWidth", QString::number( mFrameBorderWidth ) );
annotationElem.setAttribute( "frameColor", mFrameColor.name() );
annotationElem.setAttribute( "frameBackgroundColor", mFrameBackgroundColor.name() );
annotationElem.setAttribute( "frameBackgroundColorAlpha", mFrameBackgroundColor.alpha() );
diff --git a/src/mapserver/qgswmsserver.cpp b/src/mapserver/qgswmsserver.cpp
index 4c333e7..0b9d4bc 100644
--- a/src/mapserver/qgswmsserver.cpp
+++ b/src/mapserver/qgswmsserver.cpp
@@ -923,10 +923,10 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
{
QDomElement bBoxElem = result.createElement( "BoundingBox" );
bBoxElem.setAttribute( "CRS", mMapRenderer->destinationCrs().authid() );
- bBoxElem.setAttribute( "minx", featuresRect->xMinimum() );
- bBoxElem.setAttribute( "maxx", featuresRect->xMaximum() );
- bBoxElem.setAttribute( "miny", featuresRect->yMinimum() );
- bBoxElem.setAttribute( "maxy", featuresRect->yMaximum() );
+ bBoxElem.setAttribute( "minx", QString::number( featuresRect->xMinimum() ) );
+ bBoxElem.setAttribute( "maxx", QString::number( featuresRect->xMaximum() ) );
+ bBoxElem.setAttribute( "miny", QString::number( featuresRect->yMinimum() ) );
+ bBoxElem.setAttribute( "maxy", QString::number( featuresRect->yMaximum() ) );
getFeatureInfoElement.insertBefore( bBoxElem, QDomNode() ); //insert as first child
}
@@ -1382,10 +1382,10 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
//append feature bounding box to feature info xml
QDomElement bBoxElem = infoDocument.createElement( "BoundingBox" );
bBoxElem.setAttribute( version == "1.1.1" ? "SRS" : "CRS", mapRender->destinationCrs().authid() );
- bBoxElem.setAttribute( "minx", box.xMinimum() );
- bBoxElem.setAttribute( "maxx", box.xMaximum() );
- bBoxElem.setAttribute( "miny", box.yMinimum() );
- bBoxElem.setAttribute( "maxy", box.yMaximum() );
+ bBoxElem.setAttribute( "minx", QString::number( box.xMinimum() ) );
+ bBoxElem.setAttribute( "maxx", QString::number( box.xMaximum() ) );
+ bBoxElem.setAttribute( "miny", QString::number( box.yMinimum() ) );
+ bBoxElem.setAttribute( "maxy", QString::number( box.yMaximum() ) );
featureElement.appendChild( bBoxElem );
}
}
diff --git a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
index 77db354..5916505 100644
--- a/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
+++ b/src/plugins/raster_terrain_analysis/qgsrasterterrainanalysisdialog.cpp
@@ -240,8 +240,8 @@ void QgsRasterTerrainAnalysisDialog::on_mExportColorsButton_clicked()
for ( ; rColorsIt != rColors.constEnd(); ++rColorsIt )
{
QDomElement classElem = doc.createElement( "ReliefColor" );
- classElem.setAttribute( "MinElevation", rColorsIt->minElevation );
- classElem.setAttribute( "MaxElevation", rColorsIt->maxElevation );
+ classElem.setAttribute( "MinElevation", QString::number( rColorsIt->minElevation ) );
+ classElem.setAttribute( "MaxElevation", QString::number( rColorsIt->maxElevation ) );
classElem.setAttribute( "red", QString::number( rColorsIt->color.red() ) );
classElem.setAttribute( "green", QString::number( rColorsIt->color.green() ) );
classElem.setAttribute( "blue", QString::number( rColorsIt->color.blue() ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.