Skip to content

Commit

Permalink
fix type error in value relation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasMizera authored and wonder-sk committed Nov 2, 2020
1 parent ed709c1 commit d6247fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/quickgui/qgsquickfeatureslistmodel.cpp
Expand Up @@ -253,18 +253,18 @@ int QgsQuickFeaturesListModel::rowFromAttribute( const int role, const QVariant
return -1;
}

int QgsQuickFeaturesListModel::keyFromAttribute( const int role, const QVariant &value ) const
QVariant QgsQuickFeaturesListModel::keyFromAttribute( const int role, const QVariant &value ) const
{
for ( int i = 0; i < mFeatures.count(); ++i )
{
QVariant d = data( index( i, 0 ), role );
if ( d == value )
{
QVariant key = data( index( i, 0 ), KeyColumn );
return key.toInt();
return key;
}
}
return -1;
return QVariant();
}

QgsQuickFeatureLayerPair QgsQuickFeaturesListModel::featureLayerPair( const int &featureId )
Expand Down
2 changes: 1 addition & 1 deletion src/quickgui/qgsquickfeatureslistmodel.h
Expand Up @@ -112,7 +112,7 @@ class QUICK_EXPORT QgsQuickFeaturesListModel : public QAbstractListModel
* \return KeyColumn role for found feature, returns -1 if no feature is found. If more features
* match requested role and value, KeyColumn for first is returned.
*/
Q_INVOKABLE int keyFromAttribute( const int role, const QVariant &value ) const;
Q_INVOKABLE QVariant keyFromAttribute( const int role, const QVariant &value ) const;

//! Returns maximum amount of features that can be queried from layer
int featuresLimit() const;
Expand Down

0 comments on commit d6247fd

Please sign in to comment.