Skip to content
Permalink
Browse files

rename QgsFeatureChooser to QgsFeaturePicker

  • Loading branch information
3nids committed Apr 24, 2020
1 parent 3cd237e commit 82da0fd9628bae85d0515fbef381b19d403fbe15
@@ -1,14 +1,14 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturechoosermodel.h *
* src/core/qgsfeaturepickermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsFeatureChooserModel : QAbstractItemModel
class QgsFeaturePickerModel : QAbstractItemModel
{
%Docstring
Provides a list of features based on filter conditions.
@@ -18,7 +18,7 @@ Features are fetched asynchronously.
%End

%TypeHeaderCode
#include "qgsfeaturechoosermodel.h"
#include "qgsfeaturepickermodel.h"
%End
public:

@@ -29,11 +29,11 @@ Features are fetched asynchronously.
FeatureIdRole
};

explicit QgsFeatureChooserModel( QObject *parent = 0 );
explicit QgsFeaturePickerModel( QObject *parent = 0 );
%Docstring
Create a new QgsFeatureChooserModel, optionally specifying a ``parent``.
Create a new QgsFeaturePickerModel, optionally specifying a ``parent``.
%End
~QgsFeatureChooserModel();
~QgsFeaturePickerModel();

QgsVectorLayer *sourceLayer() const;
%Docstring
@@ -193,7 +193,7 @@ Add a NULL entry to the list.
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturechoosermodel.h *
* src/core/qgsfeaturepickermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -61,7 +61,7 @@
%Include auto_generated/qgsexpressioncontextscopegenerator.sip
%Include auto_generated/qgsexpressionfieldbuffer.sip
%Include auto_generated/qgsfeature.sip
%Include auto_generated/qgsfeaturechoosermodel.sip
%Include auto_generated/qgsfeaturepickermodel.sip
%Include auto_generated/qgsfeaturefiltermodel.sip
%Include auto_generated/qgsfeaturefilterprovider.sip
%Include auto_generated/qgsfeatureid.sip
@@ -1,7 +1,7 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfeaturechooserwidget.h *
* src/gui/qgsfeaturepickerwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -10,7 +10,7 @@



class QgsFeatureChooserWidget : QWidget
class QgsFeaturePickerWidget : QWidget
{
%Docstring
This offers a combobox with autocompleter that allows selecting features from a layer.
@@ -22,13 +22,13 @@ and whenever text is typed into the combobox, the completer and popup will adjus
%End

%TypeHeaderCode
#include "qgsfeaturechooserwidget.h"
#include "qgsfeaturepickerwidget.h"
%End
public:

QgsFeatureChooserWidget( QWidget *parent = 0 );
QgsFeaturePickerWidget( QWidget *parent = 0 );
%Docstring
Create a new QgsFeatureChooserWidget, optionally specifying a ``parent``.
Create a new QgsFeaturePickerWidget, optionally specifying a ``parent``.
%End

QgsVectorLayer *layer() const;
@@ -41,7 +41,7 @@ The layer from which features should be listed.
The layer from which features should be listed.
%End

void setCurrentFeature( const QgsFeature &feature );
void setCurrentFeature( QgsFeatureId featureId );
%Docstring
Sets the current index by using the given feature
%End
@@ -144,7 +144,7 @@ Sends the feature as soon as it is chosen
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfeaturechooserwidget.h *
* src/gui/qgsfeaturepickerwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -80,7 +80,7 @@
%Include auto_generated/qgsextentgroupbox.sip
%Include auto_generated/qgsextentwidget.sip
%Include auto_generated/qgsexternalresourcewidget.sip
%Include auto_generated/qgsfeaturechooserwidget.sip
%Include auto_generated/qgsfeaturepickerwidget.sip
%Include auto_generated/qgsfeaturelistcombobox.sip
%Include auto_generated/qgsfeatureselectiondlg.sip
%Include auto_generated/qgsfieldcombobox.sip
@@ -257,7 +257,7 @@ SET(QGIS_CORE_SRCS
qgsexpressioncontext.cpp
qgsexpressionfieldbuffer.cpp
qgsfeature.cpp
qgsfeaturechoosermodel.cpp
qgsfeaturepickermodel.cpp
qgsfeatureiterator.cpp
qgsfeaturerequest.cpp
qgsfeaturesink.cpp
@@ -797,7 +797,7 @@ SET(QGIS_CORE_HDRS
qgsexpressioncontextscopegenerator.h
qgsexpressionfieldbuffer.h
qgsfeature.h
qgsfeaturechoosermodel.h
qgsfeaturepickermodel.h
qgsfeatureexpressionvaluesgatherer.h
qgsfeaturefiltermodel.h
qgsfeaturefilterprovider.h
@@ -1,5 +1,5 @@
/***************************************************************************
qgsfeaturechoosermodel.cpp - QgsFeatureChooserModel
qgsfeaturepickermodel.cpp - QgsFeaturePickerModel
---------------------
begin : 03.04.2020
copyright : (C) 2020 by Denis Rouzaud
@@ -12,7 +12,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsfeaturechoosermodel.h"
#include "qgsfeaturepickermodel.h"
#include "qgsfeatureexpressionvaluesgatherer.h"

#include "qgsvectorlayer.h"
@@ -21,27 +21,27 @@
#include "qgssettings.h"


QgsFeatureChooserModel::QgsFeatureChooserModel( QObject *parent )
QgsFeaturePickerModel::QgsFeaturePickerModel( QObject *parent )
: QAbstractItemModel( parent )
{
mReloadTimer.setInterval( 100 );
mReloadTimer.setSingleShot( true );
connect( &mReloadTimer, &QTimer::timeout, this, &QgsFeatureChooserModel::scheduledReload );
connect( &mReloadTimer, &QTimer::timeout, this, &QgsFeaturePickerModel::scheduledReload );
setCurrentFeatureUnguarded( FID_NULL );
}

QgsFeatureChooserModel::~QgsFeatureChooserModel()
QgsFeaturePickerModel::~QgsFeaturePickerModel()
{
if ( mGatherer )
connect( mGatherer, &QgsFeatureExpressionValuesGatherer::finished, mGatherer, &QgsFeatureExpressionValuesGatherer::deleteLater );
}

QgsVectorLayer *QgsFeatureChooserModel::sourceLayer() const
QgsVectorLayer *QgsFeaturePickerModel::sourceLayer() const
{
return mSourceLayer;
}

void QgsFeatureChooserModel::setSourceLayer( QgsVectorLayer *sourceLayer )
void QgsFeaturePickerModel::setSourceLayer( QgsVectorLayer *sourceLayer )
{
if ( mSourceLayer == sourceLayer )
return;
@@ -54,12 +54,12 @@ void QgsFeatureChooserModel::setSourceLayer( QgsVectorLayer *sourceLayer )
setDisplayExpression( sourceLayer->displayExpression() );
}

QString QgsFeatureChooserModel::displayExpression() const
QString QgsFeaturePickerModel::displayExpression() const
{
return mDisplayExpression.expression();
}

void QgsFeatureChooserModel::setDisplayExpression( const QString &displayExpression )
void QgsFeaturePickerModel::setDisplayExpression( const QString &displayExpression )
{
if ( mDisplayExpression.expression() == displayExpression )
return;
@@ -69,12 +69,12 @@ void QgsFeatureChooserModel::setDisplayExpression( const QString &displayExpress
emit displayExpressionChanged();
}

QString QgsFeatureChooserModel::filterValue() const
QString QgsFeaturePickerModel::filterValue() const
{
return mFilterValue;
}

void QgsFeatureChooserModel::setFilterValue( const QString &filterValue )
void QgsFeaturePickerModel::setFilterValue( const QString &filterValue )
{
if ( mFilterValue == filterValue )
return;
@@ -84,12 +84,12 @@ void QgsFeatureChooserModel::setFilterValue( const QString &filterValue )
emit filterValueChanged();
}

QString QgsFeatureChooserModel::filterExpression() const
QString QgsFeaturePickerModel::filterExpression() const
{
return mFilterExpression;
}

void QgsFeatureChooserModel::setFilterExpression( const QString &filterExpression )
void QgsFeaturePickerModel::setFilterExpression( const QString &filterExpression )
{
if ( mFilterExpression == filterExpression )
return;
@@ -99,37 +99,37 @@ void QgsFeatureChooserModel::setFilterExpression( const QString &filterExpressio
emit filterExpressionChanged();
}

bool QgsFeatureChooserModel::isLoading() const
bool QgsFeaturePickerModel::isLoading() const
{
return mGatherer;
}

QModelIndex QgsFeatureChooserModel::index( int row, int column, const QModelIndex &parent ) const
QModelIndex QgsFeaturePickerModel::index( int row, int column, const QModelIndex &parent ) const
{
Q_UNUSED( parent )
return createIndex( row, column, nullptr );
}

QModelIndex QgsFeatureChooserModel::parent( const QModelIndex &child ) const
QModelIndex QgsFeaturePickerModel::parent( const QModelIndex &child ) const
{
Q_UNUSED( child )
return QModelIndex();
}

int QgsFeatureChooserModel::rowCount( const QModelIndex &parent ) const
int QgsFeaturePickerModel::rowCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent )

return mEntries.size();
}

int QgsFeatureChooserModel::columnCount( const QModelIndex &parent ) const
int QgsFeaturePickerModel::columnCount( const QModelIndex &parent ) const
{
Q_UNUSED( parent )
return 1;
}

QVariant QgsFeatureChooserModel::data( const QModelIndex &index, int role ) const
QVariant QgsFeaturePickerModel::data( const QModelIndex &index, int role ) const
{
if ( !index.isValid() )
return QVariant();
@@ -194,7 +194,7 @@ QVariant QgsFeatureChooserModel::data( const QModelIndex &index, int role ) cons
return QVariant();
}

void QgsFeatureChooserModel::updateCompleter()
void QgsFeaturePickerModel::updateCompleter()
{
emit beginUpdate();

@@ -313,7 +313,7 @@ void QgsFeatureChooserModel::updateCompleter()
emit isLoadingChanged();
}

void QgsFeatureChooserModel::scheduledReload()
void QgsFeaturePickerModel::scheduledReload()
{
if ( !mSourceLayer )
return;
@@ -342,14 +342,14 @@ void QgsFeatureChooserModel::scheduledReload()
request.setLimit( QgsSettings().value( QStringLiteral( "maxEntriesRelationWidget" ), 100, QgsSettings::Gui ).toInt() );

mGatherer = new QgsFeatureExpressionValuesGatherer( mSourceLayer, mDisplayExpression, request );
connect( mGatherer, &QgsFeatureExpressionValuesGatherer::finished, this, &QgsFeatureChooserModel::updateCompleter );
connect( mGatherer, &QgsFeatureExpressionValuesGatherer::finished, this, &QgsFeaturePickerModel::updateCompleter );

mGatherer->start();
if ( !wasLoading )
emit isLoadingChanged();
}

void QgsFeatureChooserModel::setCurrentIndex( int index, bool force )
void QgsFeaturePickerModel::setCurrentIndex( int index, bool force )
{
if ( mCurrentIndex == index && !force )
return;
@@ -359,7 +359,7 @@ void QgsFeatureChooserModel::setCurrentIndex( int index, bool force )
emit currentFeatureChanged( currentFeature() );
}

void QgsFeatureChooserModel::setCurrentFeature( const QgsFeatureId &featureId )
void QgsFeaturePickerModel::setCurrentFeature( const QgsFeatureId &featureId )
{
if ( featureId == 0 || featureId == currentFeature().id() )
return;
@@ -374,7 +374,7 @@ void QgsFeatureChooserModel::setCurrentFeature( const QgsFeatureId &featureId )
mIsSettingCurrentFeature = false;
}

void QgsFeatureChooserModel::setCurrentFeatureUnguarded( const QgsFeatureId &featureId )
void QgsFeaturePickerModel::setCurrentFeatureUnguarded( const QgsFeatureId &featureId )
{
const QVector<QgsFeatureExpressionValuesGatherer::Entry> entries = mEntries;

@@ -399,7 +399,7 @@ void QgsFeatureChooserModel::setCurrentFeatureUnguarded( const QgsFeatureId &fea
}
}

QgsConditionalStyle QgsFeatureChooserModel::featureStyle( const QgsFeature &feature ) const
QgsConditionalStyle QgsFeaturePickerModel::featureStyle( const QgsFeature &feature ) const
{
if ( !mSourceLayer )
return QgsConditionalStyle();
@@ -427,12 +427,12 @@ QgsConditionalStyle QgsFeatureChooserModel::featureStyle( const QgsFeature &feat
return style;
}

bool QgsFeatureChooserModel::allowNull() const
bool QgsFeaturePickerModel::allowNull() const
{
return mAllowNull;
}

void QgsFeatureChooserModel::setAllowNull( bool allowNull )
void QgsFeaturePickerModel::setAllowNull( bool allowNull )
{
if ( mAllowNull == allowNull )
return;
@@ -443,15 +443,15 @@ void QgsFeatureChooserModel::setAllowNull( bool allowNull )
reload();
}

QgsFeature QgsFeatureChooserModel::currentFeature() const
QgsFeature QgsFeaturePickerModel::currentFeature() const
{
if ( mCurrentIndex < mEntries.count() )
return mEntries.at( mCurrentIndex ).feature;
else
return QgsFeature();
}

void QgsFeatureChooserModel::reload()
void QgsFeaturePickerModel::reload()
{
mReloadTimer.start();
}

0 comments on commit 82da0fd

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