Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE] Add QgsFeatureListComboBox with live-filter-capabilities
  • Loading branch information
m-kuhn committed Oct 26, 2017
1 parent d40447e commit 7811f38
Show file tree
Hide file tree
Showing 12 changed files with 1,281 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -311,6 +311,7 @@
%Include qgsfieldmodel.sip
%Include qgsfieldproxymodel.sip
%Include qgsfiledownloader.sip
%Include qgsfeaturefiltermodel.sip
%Include qgsgeometryvalidator.sip
%Include qgsgml.sip
%Include qgsgmlschema.sip
Expand Down
118 changes: 118 additions & 0 deletions python/core/qgsfeaturefiltermodel.sip
@@ -0,0 +1,118 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturefiltermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsFeatureFilterModel : QAbstractItemModel
{
%Docstring
Provides a list of features based on filter conditions.
Features are fetched asynchronously.
%End

%TypeHeaderCode
#include "qgsfeaturefiltermodel.h"
%End
public:
enum Role
{
IdentifierValueRole,
ValueRole
};

QgsFeatureFilterModel( QObject *parent = 0 );
~QgsFeatureFilterModel();

QgsVectorLayer *sourceLayer() const;
%Docstring
:rtype: QgsVectorLayer
%End
void setSourceLayer( QgsVectorLayer *sourceLayer );

QString displayExpression() const;
%Docstring
:rtype: str
%End
void setDisplayExpression( const QString &displayExpression );

QString filterValue() const;
%Docstring
:rtype: str
%End
void setFilterValue( const QString &filterValue );

virtual QModelIndex index( int row, int column, const QModelIndex &parent ) const;
virtual QModelIndex parent( const QModelIndex &child ) const;
virtual int rowCount( const QModelIndex &parent ) const;
virtual int columnCount( const QModelIndex &parent ) const;
virtual QVariant data( const QModelIndex &index, int role ) const;

QString filterExpression() const;
%Docstring
An additional filter expression to apply, next to the filterValue.
Can be used for spatial filtering etc.
:rtype: str
%End

void setFilterExpression( const QString &filterExpression );
%Docstring
An additional filter expression to apply, next to the filterValue.
Can be used for spatial filtering etc.
%End

bool isLoading() const;
%Docstring
:rtype: bool
%End

QString identifierField() const;
%Docstring
:rtype: str
%End
void setIdentifierField( const QString &identifierField );

QVariant extraIdentifierValue() const;
%Docstring
:rtype: QVariant
%End
void setExtraIdentifierValue( const QVariant &extraIdentifierValue );

int extraIdentifierValueIndex() const;
%Docstring
:rtype: int
%End

bool extraValueDoesNotExist() const;
%Docstring
:rtype: bool
%End

signals:
void sourceLayerChanged();
void displayExpressionChanged();
void filterValueChanged();
void filterExpressionChanged();
void isLoadingChanged();
void identifierFieldChanged();
void filterJobCompleted();
void extraIdentifierValueChanged();
void extraIdentifierValueIndexChanged( int index );
void extraValueDoesNotExistChanged();
void beginUpdate();
void endUpdate();

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfeaturefiltermodel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -108,6 +108,7 @@
%Include qgsfeatureselectiondlg.sip
%Include qgsfieldcombobox.sip
%Include qgsfieldexpressionwidget.sip
%Include qgsfeaturelistcombobox.sip
%Include qgsfieldvalidator.sip
%Include qgsfieldvalueslineedit.sip
%Include qgsfilewidget.sip
Expand Down
104 changes: 104 additions & 0 deletions python/gui/qgsfeaturelistcombobox.sip
@@ -0,0 +1,104 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfeaturelistcombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsFeatureListComboBox : QComboBox
{
%Docstring
*************************************************************************
qgsfieldlistcombobox.h - QgsFieldListComboBox

---------------------
begin : 10.3.2017
copyright : (C) 2017 by Matthias Kuhn
email : matthias@opengis.ch
**************************************************************************
*
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *
*
**************************************************************************
%End

%TypeHeaderCode
#include "qgsfeaturelistcombobox.h"
%End
public:
QgsFeatureListComboBox( QWidget *parent = 0 );

QgsVectorLayer *sourceLayer() const;
%Docstring
:rtype: QgsVectorLayer
%End
void setSourceLayer( QgsVectorLayer *sourceLayer );

QString displayExpression() const;
%Docstring
:rtype: str
%End
void setDisplayExpression( const QString &displayExpression );

QString filterExpression() const;
%Docstring
:rtype: str
%End
void setFilterExpression( const QString &filterExpression );

QVariant identifierValue() const;
%Docstring
:rtype: QVariant
%End
void setIdentifierValue( const QVariant &identifierValue );

QgsFeatureRequest currentFeatureRequest() const;
%Docstring
:rtype: QgsFeatureRequest
%End

bool allowNull() const;
%Docstring
:rtype: bool
%End
void setAllowNull( bool allowNull );

QString identifierField() const;
%Docstring
:rtype: str
%End
void setIdentifierField( const QString &identifierField );

QModelIndex currentModelIndex() const;
%Docstring
:rtype: QModelIndex
%End

virtual void focusOutEvent( QFocusEvent *event );

virtual void keyPressEvent( QKeyEvent *event );

signals:
void sourceLayerChanged();
void displayExpressionChanged();
void filterExpressionChanged();
void identifierValueChanged();
void identifierFieldChanged();
void allowNullChanged();

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfeaturelistcombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
3 changes: 3 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -175,6 +175,7 @@ SET(QGIS_CORE_SRCS
qgsfeaturesink.cpp
qgsfeaturesource.cpp
qgsfeaturestore.cpp
qgsfeaturefiltermodel.cpp
qgsfield.cpp
qgsfieldconstraints.cpp
qgsfieldformatter.cpp
Expand Down Expand Up @@ -590,6 +591,8 @@ SET(QGIS_CORE_MOC_HDRS
qgsfieldmodel.h
qgsfieldproxymodel.h
qgsfiledownloader.h
qgsfeaturefiltermodel.h
qgsfeaturefiltermodel_p.h
qgsgeometryvalidator.h
qgsgml.h
qgsgmlschema.h
Expand Down

0 comments on commit 7811f38

Please sign in to comment.