Skip to content

Commit bd4f712

Browse files
committedApr 19, 2017
sipify QgsMapLayerCombobox, QgsFieldCombobox
1 parent 7552d1c commit bd4f712

File tree

5 files changed

+201
-119
lines changed

5 files changed

+201
-119
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ gui/qgsexpressionlineedit.sip
361361
gui/qgsexpressionselectiondialog.sip
362362
gui/qgsextentgroupbox.sip
363363
gui/qgsfeatureselectiondlg.sip
364-
gui/qgsfieldcombobox.sip
365364
gui/qgsfieldmodel.sip
366365
gui/qgsfieldproxymodel.sip
367366
gui/qgsfieldvalidator.sip
@@ -393,7 +392,6 @@ gui/qgsmapcanvasitem.sip
393392
gui/qgsmapcanvassnappingutils.sip
394393
gui/qgsmapcanvastracer.sip
395394
gui/qgsmaplayeractionregistry.sip
396-
gui/qgsmaplayercombobox.sip
397395
gui/qgsmaplayerconfigwidget.sip
398396
gui/qgsmaplayerconfigwidgetfactory.sip
399397
gui/qgsmapmouseevent.sip

‎python/gui/qgsfieldcombobox.sip

Lines changed: 76 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,105 @@
1-
/**
2-
* @brief The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
3-
* It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
4-
* If expression must be used, QgsFieldExpressionWidget shall be used instead.
5-
* @see QgsMapLayerComboBox
6-
* @note added in 2.3
7-
*/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsfieldcombobox.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
814
class QgsFieldComboBox : QComboBox
915
{
16+
%Docstring
17+
The QgsFieldComboBox is a combo box which displays the list of fields of a given layer.
18+
It might be combined with a QgsMapLayerComboBox to automatically update fields according to a chosen layer.
19+
If expression must be used, QgsFieldExpressionWidget shall be used instead.
20+
\see QgsMapLayerComboBox
21+
.. versionadded:: 2.3
22+
%End
1023

1124
%TypeHeaderCode
1225
#include "qgsfieldcombobox.h"
1326
%End
14-
1527
public:
16-
/**
17-
* @brief QgsFieldComboBox creates a combo box to display the fields of a layer.
18-
* The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer.
19-
*/
28+
2029
explicit QgsFieldComboBox( QWidget *parent /TransferThis/ = 0 );
30+
%Docstring
31+
QgsFieldComboBox creates a combo box to display the fields of a layer.
32+
The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox.layerChanged to the slot setLayer.
33+
%End
2134

22-
//! setFilters allows fitering according to the type of field
2335
void setFilters( QgsFieldProxyModel::Filters filters );
36+
%Docstring
37+
setFilters allows fitering according to the type of field
38+
%End
2439

25-
//! currently used filter on list of fields
2640
QgsFieldProxyModel::Filters filters() const;
41+
%Docstring
42+
currently used filter on list of fields
43+
:rtype: QgsFieldProxyModel.Filters
44+
%End
2745

28-
/**
29-
* Sets whether an optional empty field ("not set") option is shown in the combo box.
30-
* @see allowEmptyFieldName()
31-
* @note added in QGIS 3.0
32-
*/
3346
void setAllowEmptyFieldName( bool allowEmpty );
47+
%Docstring
48+
Sets whether an optional empty field ("not set") option is shown in the combo box.
49+
\see allowEmptyFieldName()
50+
.. versionadded:: 3.0
51+
%End
3452

35-
/**
36-
* Returns true if the combo box allows the empty field ("not set") choice.
37-
* @see setAllowEmptyFieldName()
38-
* @note added in QGIS 3.0
39-
*/
4053
bool allowEmptyFieldName() const;
54+
%Docstring
55+
Returns true if the combo box allows the empty field ("not set") choice.
56+
\see setAllowEmptyFieldName()
57+
.. versionadded:: 3.0
58+
:rtype: bool
59+
%End
4160

42-
//! return the currently selected field
4361
QString currentField() const;
62+
%Docstring
63+
return the currently selected field
64+
:rtype: str
65+
%End
4466

45-
/**
46-
* Returns the layer currently associated with the combobox.
47-
* @see setLayer()
48-
*/
49-
QgsVectorLayer* layer() const;
67+
QgsVectorLayer *layer() const;
68+
%Docstring
69+
Returns the layer currently associated with the combobox.
70+
\see setLayer()
71+
:rtype: QgsVectorLayer
72+
%End
5073

5174
signals:
52-
//! the signal is emitted when the currently selected field changes
53-
void fieldChanged( const QString& fieldName );
75+
void fieldChanged( const QString &fieldName );
76+
%Docstring
77+
the signal is emitted when the currently selected field changes
78+
%End
5479

5580
public slots:
5681

57-
/**
58-
* Sets the layer for which fields are listed in the combobox. If no layer is set
59-
* or a non-vector layer is set then the combobox will be empty.
60-
* @see layer()
61-
*/
62-
void setLayer( QgsMapLayer* layer );
82+
void setLayer( QgsMapLayer *layer );
83+
%Docstring
84+
Sets the layer for which fields are listed in the combobox. If no layer is set
85+
or a non-vector layer is set then the combobox will be empty.
86+
\see layer()
87+
%End
6388

64-
//! setField sets the currently selected field
65-
void setField( const QString& fieldName );
89+
void setField( const QString &fieldName );
90+
%Docstring
91+
setField sets the currently selected field
92+
%End
6693

6794
protected slots:
6895
void indexChanged( int i );
96+
6997
};
98+
99+
/************************************************************************
100+
* This file has been generated automatically from *
101+
* *
102+
* src/gui/qgsfieldcombobox.h *
103+
* *
104+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
105+
************************************************************************/

‎python/gui/qgsmaplayercombobox.sip

Lines changed: 119 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,156 @@
1-
/**
2-
* @brief The QgsMapLayerComboBox class is a combo box which displays the list of layers
3-
* @note added in 2.3
4-
*/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsmaplayercombobox.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
514
class QgsMapLayerComboBox : QComboBox
615
{
16+
%Docstring
17+
The QgsMapLayerComboBox class is a combo box which displays the list of layers
18+
.. versionadded:: 2.3
19+
%End
720

821
%TypeHeaderCode
922
#include "qgsmaplayercombobox.h"
1023
%End
11-
1224
public:
13-
/**
14-
* @brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
15-
* The layers can be filtered and/or ordered.
16-
*/
25+
1726
explicit QgsMapLayerComboBox( QWidget *parent /TransferThis/ = 0 );
27+
%Docstring
28+
QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
29+
The layers can be filtered and/or ordered.
30+
%End
1831

19-
//! setFilters allows fitering according to layer type and/or geometry type.
20-
void setFilters( const QgsMapLayerProxyModel::Filters& filters );
32+
void setFilters( QgsMapLayerProxyModel::Filters filters );
33+
%Docstring
34+
setFilters allows fitering according to layer type and/or geometry type.
35+
%End
2136

22-
//! currently used filter on list layers
2337
QgsMapLayerProxyModel::Filters filters() const;
38+
%Docstring
39+
currently used filter on list layers
40+
:rtype: QgsMapLayerProxyModel.Filters
41+
%End
2442

25-
//! except a list of layers not to be listed
26-
void setExceptedLayerList( const QList<QgsMapLayer*>& layerList );
43+
void setExceptedLayerList( const QList<QgsMapLayer *> &layerList );
44+
%Docstring
45+
except a list of layers not to be listed
46+
%End
2747

28-
//! returns the list of excepted layers
29-
QList<QgsMapLayer*> exceptedLayerList() const;
48+
QList<QgsMapLayer *> exceptedLayerList() const;
49+
%Docstring
50+
returns the list of excepted layers
51+
:rtype: list of QgsMapLayer
52+
%End
3053

31-
/**
32-
* Sets a list of data providers which should be excluded from the combobox.
33-
* @note added in QGIS 3.0
34-
* @see excludedProviders()
35-
*/
36-
void setExcludedProviders( const QStringList& providers );
54+
void setExcludedProviders( const QStringList &providers );
55+
%Docstring
56+
Sets a list of data providers which should be excluded from the combobox.
57+
.. versionadded:: 3.0
58+
\see excludedProviders()
59+
%End
3760

38-
/**
39-
* Returns the list of data providers which are excluded from the combobox.
40-
* @see setExcludedProviders()
41-
* @note added in QGIS 3.0
42-
*/
4361
QStringList excludedProviders() const;
62+
%Docstring
63+
Returns the list of data providers which are excluded from the combobox.
64+
\see setExcludedProviders()
65+
.. versionadded:: 3.0
66+
:rtype: list of str
67+
%End
4468

45-
/**
46-
* Sets whether an optional empty layer ("not set") option is shown in the combo box.
47-
* @see allowEmptyLayer()
48-
* @note added in QGIS 3.0
49-
*/
5069
void setAllowEmptyLayer( bool allowEmpty );
70+
%Docstring
71+
Sets whether an optional empty layer ("not set") option is shown in the combo box.
72+
\see allowEmptyLayer()
73+
.. versionadded:: 3.0
74+
%End
5175

52-
/**
53-
* Returns true if the combo box allows the empty layer ("not set") choice.
54-
* @see setAllowEmptyLayer()
55-
* @note added in QGIS 3.0
56-
*/
5776
bool allowEmptyLayer() const;
77+
%Docstring
78+
Returns true if the combo box allows the empty layer ("not set") choice.
79+
\see setAllowEmptyLayer()
80+
.. versionadded:: 3.0
81+
:rtype: bool
82+
%End
5883

59-
/**
60-
* Sets whether the CRS of layers is also included in the combo box text.
61-
* @see showCrs()
62-
* @note added in QGIS 3.0
63-
*/
6484
void setShowCrs( bool showCrs );
85+
%Docstring
86+
Sets whether the CRS of layers is also included in the combo box text.
87+
\see showCrs()
88+
.. versionadded:: 3.0
89+
%End
6590

66-
/**
67-
* Returns true if the combo box shows the layer's CRS.
68-
* @see setShowCrs()
69-
* @note added in QGIS 3.0
70-
*/
7191
bool showCrs() const;
92+
%Docstring
93+
Returns true if the combo box shows the layer's CRS.
94+
\see setShowCrs()
95+
.. versionadded:: 3.0
96+
:rtype: bool
97+
%End
98+
99+
void setAdditionalItems( const QStringList &items );
100+
%Docstring
101+
Sets a list of additional (non map layer) items to include at the end of the combobox.
102+
These may represent additional layers such as layers which are not included in the map
103+
layer registry, or paths to layers which have not yet been loaded into QGIS.
104+
\see additionalItems()
105+
.. versionadded:: 3.0
106+
%End
72107

73-
/**
74-
* Sets a list of additional (non map layer) items to include at the end of the combobox.
75-
* These may represent additional layers such as layers which are not included in the map
76-
* layer registry, or paths to layers which have not yet been loaded into QGIS.
77-
* @see additionalItems()
78-
* @note added in QGIS 3.0
79-
*/
80-
void setAdditionalItems( const QStringList& items );
81-
82-
/**
83-
* Return the list of additional (non map layer) items included at the end of the combo box.
84-
* @see setAdditionalItems()
85-
* @note added in QGIS 3.0
86-
*/
87108
QStringList additionalItems() const;
109+
%Docstring
110+
Return the list of additional (non map layer) items included at the end of the combo box.
111+
\see setAdditionalItems()
112+
.. versionadded:: 3.0
113+
:rtype: list of str
114+
%End
88115

89-
/** Returns the current layer selected in the combo box.
90-
* @see layer
91-
*/
92-
QgsMapLayer* currentLayer() const;
116+
QgsMapLayer *currentLayer() const;
117+
%Docstring
118+
Returns the current layer selected in the combo box.
119+
\see layer
120+
:rtype: QgsMapLayer
121+
%End
93122

94-
/** Return the layer currently shown at the specified index within the combo box.
95-
* @param layerIndex position of layer to return
96-
* @note added in QGIS 2.10
97-
* @see currentLayer
98-
*/
99-
QgsMapLayer* layer( int layerIndex ) const;
123+
QgsMapLayer *layer( int layerIndex ) const;
124+
%Docstring
125+
Return the layer currently shown at the specified index within the combo box.
126+
\param layerIndex position of layer to return
127+
.. versionadded:: 2.10
128+
\see currentLayer
129+
:rtype: QgsMapLayer
130+
%End
100131

101132
public slots:
102-
//! setLayer set the current layer selected in the combo
103-
void setLayer( QgsMapLayer* layer );
133+
void setLayer( QgsMapLayer *layer );
134+
%Docstring
135+
setLayer set the current layer selected in the combo
136+
%End
104137

105138
signals:
106-
//! layerChanged this signal is emitted whenever the currently selected layer changes
107-
void layerChanged( QgsMapLayer* layer );
139+
void layerChanged( QgsMapLayer *layer );
140+
%Docstring
141+
layerChanged this signal is emitted whenever the currently selected layer changes
142+
%End
108143

109144
protected slots:
110145
void indexChanged( int i );
111146
void rowsChanged();
147+
112148
};
149+
150+
/************************************************************************
151+
* This file has been generated automatically from *
152+
* *
153+
* src/gui/qgsmaplayercombobox.h *
154+
* *
155+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
156+
************************************************************************/

‎src/gui/qgsfieldcombobox.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "qgsfieldproxymodel.h"
2222
#include "qgis_gui.h"
2323

24+
#include "qgis.h"
25+
2426
class QgsMapLayer;
2527
class QgsVectorLayer;
2628

@@ -44,7 +46,7 @@ class GUI_EXPORT QgsFieldComboBox : public QComboBox
4446
* \brief QgsFieldComboBox creates a combo box to display the fields of a layer.
4547
* The layer can be either manually given or dynamically set by connecting the signal QgsMapLayerComboBox::layerChanged to the slot setLayer.
4648
*/
47-
explicit QgsFieldComboBox( QWidget *parent = nullptr );
49+
explicit QgsFieldComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
4850

4951
//! setFilters allows fitering according to the type of field
5052
void setFilters( QgsFieldProxyModel::Filters filters );

‎src/gui/qgsmaplayercombobox.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "qgsmaplayerproxymodel.h"
2222
#include "qgis_gui.h"
2323

24+
#include "qgis.h"
25+
2426
class QgsMapLayer;
2527
class QgsVectorLayer;
2628

@@ -43,7 +45,7 @@ class GUI_EXPORT QgsMapLayerComboBox : public QComboBox
4345
* \brief QgsMapLayerComboBox creates a combo box to dislpay the list of layers (currently in the registry).
4446
* The layers can be filtered and/or ordered.
4547
*/
46-
explicit QgsMapLayerComboBox( QWidget *parent = nullptr );
48+
explicit QgsMapLayerComboBox( QWidget *parent SIP_TRANSFERTHIS = nullptr );
4749

4850
//! setFilters allows fitering according to layer type and/or geometry type.
4951
void setFilters( QgsMapLayerProxyModel::Filters filters ) { mProxyModel->setFilters( filters ); }

0 commit comments

Comments
 (0)
Please sign in to comment.