Skip to content

Commit

Permalink
Return invalid fid instead of null fid
Browse files Browse the repository at this point in the history
The default comparison code for two QVariants does a really crappy job
when it comes to NULL values.
I.e. it will return true for `QVariant( 0 ) == QVariant( QVariant::Int )`
We work around this issue here by returning an invalid QVariant instead,
which - and luckily also Qt is aware of this - also is different from 0.

Fix #16745
  • Loading branch information
m-kuhn committed Jul 14, 2017
1 parent 529bf3f commit 6d2bab6
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/gui/attributetable/qgsfeaturelistmodel.cpp
Expand Up @@ -75,10 +75,6 @@ QVariant QgsFeatureListModel::data( const QModelIndex &index, int role ) const
{
return QSettings().value( "qgis/nullValue", "NULL" ).toString();
}
else if ( role == QgsAttributeTableModel::FeatureIdRole )
{
return QVariant( QVariant::Int );
}
else
{
return QVariant( QVariant::Invalid );
Expand Down

0 comments on commit 6d2bab6

Please sign in to comment.