Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Code improvements
  • Loading branch information
m-kuhn committed Oct 27, 2017
1 parent 83a02eb commit 38a4eb4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion python/core/qgsfeaturefiltermodel.sip
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/core/qgsfeaturefiltermodel.cpp
Expand Up @@ -18,7 +18,6 @@

QgsFeatureFilterModel::QgsFeatureFilterModel( QObject *parent )
: QAbstractItemModel( parent )
, mSourceLayer( nullptr )
{
mReloadTimer.setInterval( 100 );
mReloadTimer.setSingleShot( true );
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsfeaturefiltermodel.h
Expand Up @@ -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();

/**
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/core/qgsfeaturefiltermodel_p.h
Expand Up @@ -42,7 +42,6 @@ class QgsFieldExpressionValuesGatherer: public QThread
: mSource( new QgsVectorLayerFeatureSource( layer ) )
, mDisplayExpression( displayExpression )
, mRequest( request )
, mWasCanceled( false )
, mIdentifierField( identifierField )
{
}
Expand All @@ -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 ) )
{
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsfeaturelistcombobox.h
Expand Up @@ -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;
Expand Down

0 comments on commit 38a4eb4

Please sign in to comment.