Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use qgsVariantEqual in some places
  • Loading branch information
elpaso committed Oct 1, 2018
1 parent b48a429 commit 5ed02a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/qgis.cpp
Expand Up @@ -189,7 +189,7 @@ bool qgsVariantLessThan( const QVariant &lhs, const QVariant &rhs )
const QList<QVariant> &rhsl = rhs.toList();

int i, n = std::min( lhsl.size(), rhsl.size() );
for ( i = 0; i < n && lhsl[i].type() == rhsl[i].type() && lhsl[i].isNull() == rhsl[i].isNull() && lhsl[i] == rhsl[i]; i++ )
for ( i = 0; i < n && lhsl[i].type() == rhsl[i].type() && qgsVariantEqual( lhsl[i], rhsl[i] ); i++ )
;

if ( i == n )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsfeaturefiltermodel.cpp
Expand Up @@ -533,7 +533,7 @@ QVariant QgsFeatureFilterModel::extraIdentifierValue() const

void QgsFeatureFilterModel::setExtraIdentifierValue( const QVariant &extraIdentifierValue )
{
if ( extraIdentifierValue == mExtraIdentifierValue && extraIdentifierValue.isNull() == mExtraIdentifierValue.isNull() && mExtraIdentifierValue.isValid() )
if ( qgsVariantEqual( extraIdentifierValue, mExtraIdentifierValue ) && mExtraIdentifierValue.isValid() )
return;

if ( mIsSettingExtraIdentifierValue )
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -357,9 +357,9 @@ bool QgsAttributeForm::saveEdits()
int n = 0;
for ( int i = 0; i < dst.count(); ++i )
{
if ( ( dst.at( i ) == src.at( i ) && dst.at( i ).isNull() == src.at( i ).isNull() ) // If field is not changed...
|| !dst.at( i ).isValid() // or the widget returns invalid (== do not change)
|| !fieldIsEditable( i ) ) // or the field cannot be edited ...
if ( qgsVariantEqual( dst.at( i ), src.at( i ) ) // If field is not changed...
|| !dst.at( i ).isValid() // or the widget returns invalid (== do not change)
|| !fieldIsEditable( i ) ) // or the field cannot be edited ...
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -2118,7 +2118,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist, Flags flags )

if ( i == flist.size() )
{
if ( v == defVal && defVal.isNull() == v.isNull() )
if ( qgsVariantEqual( v, defVal ) )
{
if ( defVal.isNull() )
{
Expand Down

0 comments on commit 5ed02a7

Please sign in to comment.