Skip to content
Permalink
Browse files

[composer] Ignore null field values or expressions which result in null

when evaluating data defined settings
  • Loading branch information
nyalldawson committed Sep 29, 2014
1 parent 8725c2d commit 6299029d8eb359f955133fbe4f567d63bf7635a7
Showing with 15 additions and 15 deletions.
  1. +8 −8 src/core/composer/qgscomposeritem.cpp
  2. +7 −7 src/core/composer/qgscomposermap.cpp
@@ -722,7 +722,7 @@ QRectF QgsComposerItem::evalItemRect( const QRectF &newRect )
bool ok;
double width = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Width:%1" ).arg( width ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
result.setWidth( width );
}
@@ -732,7 +732,7 @@ QRectF QgsComposerItem::evalItemRect( const QRectF &newRect )
bool ok;
double height = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Height:%1" ).arg( height ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
result.setHeight( height );
}
@@ -753,7 +753,7 @@ QRectF QgsComposerItem::evalItemRect( const QRectF &newRect )
bool ok;
double positionX = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Position X:%1" ).arg( positionX ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
x = positionX;
}
@@ -775,7 +775,7 @@ QRectF QgsComposerItem::evalItemRect( const QRectF &newRect )
bool ok;
double positionY = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Position Y:%1" ).arg( positionY ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
y = positionY;
}
@@ -861,7 +861,7 @@ void QgsComposerItem::refreshBlendMode()

//data defined blend mode set?
QVariant exprVal;
if ( dataDefinedEvaluate( QgsComposerObject::BlendMode, exprVal ) )
if ( dataDefinedEvaluate( QgsComposerObject::BlendMode, exprVal ) && !exprVal.isNull() )
{
QString blendstr = exprVal.toString().trimmed();
QPainter::CompositionMode blendModeD = QgsSymbolLayerV2Utils::decodeBlendMode( blendstr );
@@ -891,7 +891,7 @@ void QgsComposerItem::refreshTransparency( const bool updateItem )
bool ok;
int transparencyD = exprVal.toInt( &ok );
QgsDebugMsg( QString( "exprVal Transparency:%1" ).arg( transparencyD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
transparency = transparencyD;
}
@@ -1041,7 +1041,7 @@ void QgsComposerItem::refreshRotation( const bool updateItem , const bool adjust
bool ok;
double rotD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Rotation:%1" ).arg( rotD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
rotation = rotD;
}
@@ -1332,7 +1332,7 @@ void QgsComposerItem::refreshDataDefinedProperty( const QgsComposerObject::DataD
bool exclude = mExcludeFromExports;
//data defined exclude from exports set?
QVariant exprVal;
if ( dataDefinedEvaluate( QgsComposerObject::ExcludeFromExports, exprVal ) )
if ( dataDefinedEvaluate( QgsComposerObject::ExcludeFromExports, exprVal ) && !exprVal.isNull() )
{
exclude = exprVal.toBool();
}
@@ -944,7 +944,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
minXD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map XMin:%1" ).arg( minXD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
useDdXMin = true;
newExtent.setXMinimum( minXD );
@@ -955,7 +955,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
minYD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map YMin:%1" ).arg( minYD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
useDdYMin = true;
newExtent.setYMinimum( minYD );
@@ -966,7 +966,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
maxXD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map XMax:%1" ).arg( maxXD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
useDdXMax = true;
newExtent.setXMaximum( maxXD );
@@ -977,7 +977,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
maxYD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map YMax:%1" ).arg( maxYD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
useDdYMax = true;
newExtent.setYMaximum( maxYD );
@@ -1021,7 +1021,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
double scaleD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map Scale:%1" ).arg( scaleD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
setNewScale( scaleD, false );
newExtent = *currentMapExtent();
@@ -1072,7 +1072,7 @@ void QgsComposerMap::refreshMapExtents()
bool ok;
double rotationD = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map Rotation:%1" ).arg( rotationD ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
mapRotation = rotationD;
}
@@ -2331,7 +2331,7 @@ double QgsComposerMap::atlasMargin( const QgsComposerObject::PropertyValueType v
bool ok;
double ddMargin = exprVal.toDouble( &ok );
QgsDebugMsg( QString( "exprVal Map Atlas Margin:%1" ).arg( ddMargin ) );
if ( ok )
if ( ok && !exprVal.isNull() )
{
//divide by 100 to convert to 0 -> 1.0 range
margin = ddMargin / 100;

0 comments on commit 6299029

Please sign in to comment.
You can’t perform that action at this time.