Skip to content

Commit 7811f38

Browse files
committedOct 26, 2017
[FEATURE] Add QgsFeatureListComboBox with live-filter-capabilities
1 parent d40447e commit 7811f38

12 files changed

+1281
-0
lines changed
 

‎python/core/core_auto.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
%Include qgsfieldmodel.sip
312312
%Include qgsfieldproxymodel.sip
313313
%Include qgsfiledownloader.sip
314+
%Include qgsfeaturefiltermodel.sip
314315
%Include qgsgeometryvalidator.sip
315316
%Include qgsgml.sip
316317
%Include qgsgmlschema.sip

‎python/core/qgsfeaturefiltermodel.sip

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/qgsfeaturefiltermodel.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsFeatureFilterModel : QAbstractItemModel
13+
{
14+
%Docstring
15+
Provides a list of features based on filter conditions.
16+
Features are fetched asynchronously.
17+
%End
18+
19+
%TypeHeaderCode
20+
#include "qgsfeaturefiltermodel.h"
21+
%End
22+
public:
23+
enum Role
24+
{
25+
IdentifierValueRole,
26+
ValueRole
27+
};
28+
29+
QgsFeatureFilterModel( QObject *parent = 0 );
30+
~QgsFeatureFilterModel();
31+
32+
QgsVectorLayer *sourceLayer() const;
33+
%Docstring
34+
:rtype: QgsVectorLayer
35+
%End
36+
void setSourceLayer( QgsVectorLayer *sourceLayer );
37+
38+
QString displayExpression() const;
39+
%Docstring
40+
:rtype: str
41+
%End
42+
void setDisplayExpression( const QString &displayExpression );
43+
44+
QString filterValue() const;
45+
%Docstring
46+
:rtype: str
47+
%End
48+
void setFilterValue( const QString &filterValue );
49+
50+
virtual QModelIndex index( int row, int column, const QModelIndex &parent ) const;
51+
virtual QModelIndex parent( const QModelIndex &child ) const;
52+
virtual int rowCount( const QModelIndex &parent ) const;
53+
virtual int columnCount( const QModelIndex &parent ) const;
54+
virtual QVariant data( const QModelIndex &index, int role ) const;
55+
56+
QString filterExpression() const;
57+
%Docstring
58+
An additional filter expression to apply, next to the filterValue.
59+
Can be used for spatial filtering etc.
60+
:rtype: str
61+
%End
62+
63+
void setFilterExpression( const QString &filterExpression );
64+
%Docstring
65+
An additional filter expression to apply, next to the filterValue.
66+
Can be used for spatial filtering etc.
67+
%End
68+
69+
bool isLoading() const;
70+
%Docstring
71+
:rtype: bool
72+
%End
73+
74+
QString identifierField() const;
75+
%Docstring
76+
:rtype: str
77+
%End
78+
void setIdentifierField( const QString &identifierField );
79+
80+
QVariant extraIdentifierValue() const;
81+
%Docstring
82+
:rtype: QVariant
83+
%End
84+
void setExtraIdentifierValue( const QVariant &extraIdentifierValue );
85+
86+
int extraIdentifierValueIndex() const;
87+
%Docstring
88+
:rtype: int
89+
%End
90+
91+
bool extraValueDoesNotExist() const;
92+
%Docstring
93+
:rtype: bool
94+
%End
95+
96+
signals:
97+
void sourceLayerChanged();
98+
void displayExpressionChanged();
99+
void filterValueChanged();
100+
void filterExpressionChanged();
101+
void isLoadingChanged();
102+
void identifierFieldChanged();
103+
void filterJobCompleted();
104+
void extraIdentifierValueChanged();
105+
void extraIdentifierValueIndexChanged( int index );
106+
void extraValueDoesNotExistChanged();
107+
void beginUpdate();
108+
void endUpdate();
109+
110+
};
111+
112+
/************************************************************************
113+
* This file has been generated automatically from *
114+
* *
115+
* src/core/qgsfeaturefiltermodel.h *
116+
* *
117+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
118+
************************************************************************/

‎python/gui/gui_auto.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
%Include qgsfeatureselectiondlg.sip
109109
%Include qgsfieldcombobox.sip
110110
%Include qgsfieldexpressionwidget.sip
111+
%Include qgsfeaturelistcombobox.sip
111112
%Include qgsfieldvalidator.sip
112113
%Include qgsfieldvalueslineedit.sip
113114
%Include qgsfilewidget.sip

‎python/gui/qgsfeaturelistcombobox.sip

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsfeaturelistcombobox.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsFeatureListComboBox : QComboBox
13+
{
14+
%Docstring
15+
*************************************************************************
16+
qgsfieldlistcombobox.h - QgsFieldListComboBox
17+
18+
---------------------
19+
begin : 10.3.2017
20+
copyright : (C) 2017 by Matthias Kuhn
21+
email : matthias@opengis.ch
22+
**************************************************************************
23+
*
24+
This program is free software; you can redistribute it and/or modify *
25+
it under the terms of the GNU General Public License as published by *
26+
the Free Software Foundation; either version 2 of the License, or *
27+
(at your option) any later version. *
28+
*
29+
**************************************************************************
30+
%End
31+
32+
%TypeHeaderCode
33+
#include "qgsfeaturelistcombobox.h"
34+
%End
35+
public:
36+
QgsFeatureListComboBox( QWidget *parent = 0 );
37+
38+
QgsVectorLayer *sourceLayer() const;
39+
%Docstring
40+
:rtype: QgsVectorLayer
41+
%End
42+
void setSourceLayer( QgsVectorLayer *sourceLayer );
43+
44+
QString displayExpression() const;
45+
%Docstring
46+
:rtype: str
47+
%End
48+
void setDisplayExpression( const QString &displayExpression );
49+
50+
QString filterExpression() const;
51+
%Docstring
52+
:rtype: str
53+
%End
54+
void setFilterExpression( const QString &filterExpression );
55+
56+
QVariant identifierValue() const;
57+
%Docstring
58+
:rtype: QVariant
59+
%End
60+
void setIdentifierValue( const QVariant &identifierValue );
61+
62+
QgsFeatureRequest currentFeatureRequest() const;
63+
%Docstring
64+
:rtype: QgsFeatureRequest
65+
%End
66+
67+
bool allowNull() const;
68+
%Docstring
69+
:rtype: bool
70+
%End
71+
void setAllowNull( bool allowNull );
72+
73+
QString identifierField() const;
74+
%Docstring
75+
:rtype: str
76+
%End
77+
void setIdentifierField( const QString &identifierField );
78+
79+
QModelIndex currentModelIndex() const;
80+
%Docstring
81+
:rtype: QModelIndex
82+
%End
83+
84+
virtual void focusOutEvent( QFocusEvent *event );
85+
86+
virtual void keyPressEvent( QKeyEvent *event );
87+
88+
signals:
89+
void sourceLayerChanged();
90+
void displayExpressionChanged();
91+
void filterExpressionChanged();
92+
void identifierValueChanged();
93+
void identifierFieldChanged();
94+
void allowNullChanged();
95+
96+
};
97+
98+
/************************************************************************
99+
* This file has been generated automatically from *
100+
* *
101+
* src/gui/qgsfeaturelistcombobox.h *
102+
* *
103+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
104+
************************************************************************/

‎src/core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ SET(QGIS_CORE_SRCS
175175
qgsfeaturesink.cpp
176176
qgsfeaturesource.cpp
177177
qgsfeaturestore.cpp
178+
qgsfeaturefiltermodel.cpp
178179
qgsfield.cpp
179180
qgsfieldconstraints.cpp
180181
qgsfieldformatter.cpp
@@ -590,6 +591,8 @@ SET(QGIS_CORE_MOC_HDRS
590591
qgsfieldmodel.h
591592
qgsfieldproxymodel.h
592593
qgsfiledownloader.h
594+
qgsfeaturefiltermodel.h
595+
qgsfeaturefiltermodel_p.h
593596
qgsgeometryvalidator.h
594597
qgsgml.h
595598
qgsgmlschema.h

0 commit comments

Comments
 (0)
Please sign in to comment.