Skip to content
Permalink
Browse files

astyle check

  • Loading branch information
tomasMizera authored and wonder-sk committed Sep 11, 2020
1 parent 2bdff7d commit fda6324823a25a0dc06ec6cb9b2f695d26c1affb
Showing with 39 additions and 35 deletions.
  1. +7 −5 src/quickgui/qgsquickfeatureslistmodel.cpp
  2. +32 −30 src/quickgui/qgsquickfeatureslistmodel.h
@@ -60,13 +60,15 @@ QVariant QgsQuickFeaturesListModel::data( const QModelIndex &index, int role ) c
case FeatureId: return QVariant( pair.feature().id() );
case Feature: return QVariant::fromValue<QgsFeature>( pair.feature() );
case Description: return QVariant( QString( "Feature ID %1" ).arg( pair.feature().id() ) );
case EmitableIndex: {
case EmitableIndex:
{
if ( mModelType == modelTypes::ValueRelation )
return pair.feature().attribute( mKeyFieldName );
return pair.feature().id();
}
case FoundPair: return foundPair( pair );
case Qt::DisplayRole: {
case Qt::DisplayRole:
{
if ( row >= 0 && row < mCache.count() )
{
int r = rowIndexFromKey( pair.feature().attribute( mKeyFieldName ) );
@@ -244,10 +246,10 @@ int QgsQuickFeaturesListModel::rowIndexFromKey( const QVariant &key ) const

int QgsQuickFeaturesListModel::rowIndexFromKeyModel( const QVariant &key ) const
{
for ( int i = 0; i< mFeatures.count(); ++i )
for ( int i = 0; i < mFeatures.count(); ++i )
{
if ( mFeatures[i].feature().attribute( mKeyFieldName ) == key )
return i;
if ( mFeatures[i].feature().attribute( mKeyFieldName ) == key )
return i;
}
QgsDebugMsg( "Could not find index in features model, index: " + key.toString() );
return -1;
@@ -9,31 +9,31 @@

class QUICK_EXPORT QgsQuickFeaturesListModel : public QAbstractListModel
{
Q_OBJECT

Q_PROPERTY( int featuresCount READ featuresCount NOTIFY featuresCountChanged )
Q_PROPERTY( QString filterExpression READ filterExpression WRITE setFilterExpression NOTIFY filterExpressionChanged )
Q_PROPERTY( int featuresLimit READ featuresLimit NOTIFY featuresLimitChanged )
Q_PROPERTY( modelTypes modelType READ modelType WRITE setModelType )

enum roleNames
{
FeatureTitle = Qt::UserRole + 1,
FeatureId,
Feature,
Description, // secondary text in list view
EmitableIndex, // key in value relation
FoundPair // pair of attribute and its value by which the feature was found, empty if mFilterExpression is empty
};

public:

enum modelTypes
{
FeatureListing,
ValueRelation
};
Q_ENUM( modelTypes );
Q_OBJECT

Q_PROPERTY( int featuresCount READ featuresCount NOTIFY featuresCountChanged )
Q_PROPERTY( QString filterExpression READ filterExpression WRITE setFilterExpression NOTIFY filterExpressionChanged )
Q_PROPERTY( int featuresLimit READ featuresLimit NOTIFY featuresLimitChanged )
Q_PROPERTY( modelTypes modelType READ modelType WRITE setModelType )

enum roleNames
{
FeatureTitle = Qt::UserRole + 1,
FeatureId,
Feature,
Description, // secondary text in list view
EmitableIndex, // key in value relation
FoundPair // pair of attribute and its value by which the feature was found, empty if mFilterExpression is empty
};

public:

enum modelTypes
{
FeatureListing,
ValueRelation
};
Q_ENUM( modelTypes );

explicit QgsQuickFeaturesListModel( QObject *parent = nullptr );
~QgsQuickFeaturesListModel() override {};
@@ -66,10 +66,10 @@ class QUICK_EXPORT QgsQuickFeaturesListModel : public QAbstractListModel

modelTypes modelType() const;

public slots:
public slots:
void setModelType( modelTypes modelType );

signals:
signals:
void featuresCountChanged( int featuresCount );
void featuresLimitChanged( int featuresLimit );
void filterExpressionChanged( QString filterExpression );
@@ -87,9 +87,11 @@ public slots:
//! Returns found attribute and its value from mFilterExpression
QString foundPair( const QgsQuickFeatureLayerPair &feat ) const;

//! QList of loaded features from layer
//! Hold maximum of FEATURES_LIMIT features
//! \note mFeatures.size() is not always the same as mFeaturesCount
/**
* QList of loaded features from layer
* Hold maximum of FEATURES_LIMIT features
* \note mFeatures.size() is not always the same as mFeaturesCount
*/
QList<QgsQuickFeatureLayerPair> mFeatures;

//! Number of maximum features loaded from layer

0 comments on commit fda6324

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