Skip to content
Permalink
Browse files

Code improvements

  • Loading branch information
m-kuhn committed Oct 27, 2017
1 parent 83a02eb commit 38a4eb48be4a333c4ed8c9214a97856e3235ad32
@@ -29,7 +29,7 @@ class QgsFeatureFilterModel : QAbstractItemModel
ValueRole
};

QgsFeatureFilterModel( QObject *parent = 0 );
explicit QgsFeatureFilterModel( QObject *parent = 0 );
%Docstring
Create a new QgsFeatureFilterModel, optionally specifying a ``parent``.
%End
@@ -18,7 +18,6 @@

QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
: QAbstractItemModel( parent )
, mSourceLayer( nullptr )
{
mReloadTimer.setInterval( 100 );
mReloadTimer.setSingleShot( true );
@@ -196,7 +195,7 @@ void QgsFeatureFilterModel::updateCompleter()
if ( mAllowNull )
entries.prepend( Entry( QVariant( QVariant::Int ), tr( "NULL" ) ) );

int newEntriesSize = entries.size();
const int newEntriesSize = entries.size();

// Find the index of the extra entry in the new list
int currentEntryInNewList = -1;
@@ -68,7 +68,7 @@ class CORE_EXPORT QgsFeatureFilterModel : public QAbstractItemModel
/**
* Create a new QgsFeatureFilterModel, optionally specifying a \a parent.
*/
QgsFeatureFilterModel( QObject *parent = nullptr );
explicit QgsFeatureFilterModel( QObject *parent = nullptr );
~QgsFeatureFilterModel();

/**
@@ -280,7 +280,7 @@ class CORE_EXPORT QgsFeatureFilterModel : public QAbstractItemModel
bool operator()( const Entry &lhs, const Entry &rhs ) const;
};

QgsVectorLayer *mSourceLayer;
QgsVectorLayer *mSourceLayer = nullptr;
QString mDisplayExpression;
QString mFilterValue;
QString mFilterExpression;
@@ -42,7 +42,6 @@ class QgsFieldExpressionValuesGatherer: public QThread
: mSource( new QgsVectorLayerFeatureSource( layer ) )
, mDisplayExpression( displayExpression )
, mRequest( request )
, mWasCanceled( false )
, mIdentifierField( identifierField )
{
}
@@ -60,7 +59,7 @@ class QgsFieldExpressionValuesGatherer: public QThread
mDisplayExpression.prepare( &mExpressionContext );

QgsFeature feat;
int attribute = mSource->fields().indexOf( mIdentifierField );
const int attribute = mSource->fields().indexOf( mIdentifierField );

while ( mIterator.nextFeature( feat ) )
{
@@ -124,7 +123,7 @@ class QgsFieldExpressionValuesGatherer: public QThread
QgsExpressionContext mExpressionContext;
QgsFeatureRequest mRequest;
QgsFeatureIterator mIterator;
bool mWasCanceled;
bool mWasCanceled = false;
QVector<QgsFeatureFilterModel::Entry> mEntries;
QString mIdentifierField;
QVariant mData;
@@ -198,8 +198,8 @@ class GUI_EXPORT QgsFeatureListComboBox : public QComboBox
int cursorPosition;
};

QgsFeatureFilterModel *mModel;
QCompleter *mCompleter;
QgsFeatureFilterModel *mModel = nullptr;
QCompleter *mCompleter = nullptr;
QString mDisplayExpression;
QgsFilterLineEdit *mLineEdit;
bool mPopupRequested = false;

0 comments on commit 38a4eb4

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