Skip to content
Permalink
Browse files

Fix isIntSafe and isDoubleSafe not considering QVariant::UInt, QVaria…

…nt::LongLong, QVariant::ULongLong (Funded by Sourcepole)
  • Loading branch information
manisandro committed Dec 1, 2014
1 parent 974511f commit 29d0166475fa9b8b0ff72db6eb037cc36fdde1c0
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/core/qgsexpression.cpp
@@ -162,13 +162,20 @@ static QVariant tvl2variant( TVL v )
inline bool isIntSafe( const QVariant& v )
{
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::Double ) return false;
if ( v.type() == QVariant::String ) { bool ok; v.toString().toInt( &ok ); return ok; }
return false;
}
inline bool isDoubleSafe( const QVariant& v )
{
if ( v.type() == QVariant::Double || v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::Double ) return true;
if ( v.type() == QVariant::Int ) return true;
if ( v.type() == QVariant::UInt ) return true;
if ( v.type() == QVariant::LongLong ) return true;
if ( v.type() == QVariant::ULongLong ) return true;
if ( v.type() == QVariant::String ) { bool ok; v.toString().toDouble( &ok ); return ok; }
return false;
}

0 comments on commit 29d0166

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