|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/gui/qgsfieldexpressionwidget.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
1 | 14 |
|
2 | 15 | class QgsFieldExpressionWidget : QWidget |
3 | 16 | { |
| 17 | +%Docstring |
| 18 | + The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions |
| 19 | + It contains a combo boxto display the fields and expression and a button to open the expression dialog. |
| 20 | + The combo box is editable, allowing expressions to be edited inline. |
| 21 | + The validity of the expression is checked live on key press, invalid expressions are displayed in red. |
| 22 | + The expression will be added to the model (and the fieldChanged signals emitted) |
| 23 | + only when editing in the line edit is finished (focus lost, enter key pressed). |
| 24 | +%End |
| 25 | + |
4 | 26 | %TypeHeaderCode |
5 | 27 | #include "qgsfieldexpressionwidget.h" |
6 | 28 | %End |
7 | | - |
8 | 29 | public: |
9 | | - /** |
10 | | - * @brief QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog |
11 | | - */ |
| 30 | + |
12 | 31 | explicit QgsFieldExpressionWidget( QWidget *parent /TransferThis/ = 0 ); |
| 32 | +%Docstring |
| 33 | + QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog |
| 34 | +%End |
13 | 35 |
|
14 | | - //! define the title used in the expression dialog |
15 | | - void setExpressionDialogTitle( const QString& title ); |
| 36 | + void setExpressionDialogTitle( const QString &title ); |
| 37 | +%Docstring |
| 38 | +define the title used in the expression dialog |
| 39 | +%End |
16 | 40 |
|
17 | | - //! return the title used for the expression dialog |
18 | 41 | const QString expressionDialogTitle(); |
| 42 | +%Docstring |
| 43 | +return the title used for the expression dialog |
| 44 | + :rtype: str |
| 45 | +%End |
19 | 46 |
|
20 | | - //! setFilters allows fitering according to the type of field |
21 | 47 | void setFilters( QgsFieldProxyModel::Filters filters ); |
| 48 | +%Docstring |
| 49 | +setFilters allows fitering according to the type of field |
| 50 | +%End |
22 | 51 |
|
23 | 52 | void setLeftHandButtonStyle( bool isLeft ); |
24 | 53 |
|
25 | | - //! currently used filter on list of fields |
26 | 54 | QgsFieldProxyModel::Filters filters() const; |
| 55 | +%Docstring |
| 56 | +currently used filter on list of fields |
| 57 | + :rtype: QgsFieldProxyModel.Filters |
| 58 | +%End |
27 | 59 |
|
28 | | - //! set the geometry calculator used in the expression dialog |
29 | 60 | void setGeomCalculator( const QgsDistanceArea &da ); |
| 61 | +%Docstring |
| 62 | +set the geometry calculator used in the expression dialog |
| 63 | +%End |
30 | 64 |
|
31 | | - /** |
32 | | - * @brief currentField returns the currently selected field or expression if allowed |
33 | | - * @param isExpression determines if the string returned is the name of a field or an expression |
34 | | - * @param isValid determines if the expression (or field) returned is valid |
35 | | - */ |
36 | 65 | QString currentField( bool *isExpression = 0, bool *isValid = 0 ) const; |
| 66 | +%Docstring |
| 67 | + currentField returns the currently selected field or expression if allowed |
| 68 | + \param isExpression determines if the string returned is the name of a field or an expression |
| 69 | + \param isValid determines if the expression (or field) returned is valid |
| 70 | + :rtype: str |
| 71 | +%End |
37 | 72 |
|
38 | | - /** |
39 | | - * Return true if the current expression is valid |
40 | | - */ |
41 | 73 | bool isValidExpression( QString *expressionError = 0 ) const; |
| 74 | +%Docstring |
| 75 | + Return true if the current expression is valid |
| 76 | + :rtype: bool |
| 77 | +%End |
42 | 78 |
|
43 | 79 | bool isExpression() const; |
44 | | - /** |
45 | | - * Return the current text that is set in the expression area |
46 | | - */ |
| 80 | +%Docstring |
| 81 | + If the content is not just a simple field this method will return true. |
| 82 | + :rtype: bool |
| 83 | +%End |
| 84 | + |
47 | 85 | QString currentText() const; |
| 86 | +%Docstring |
| 87 | + Return the current text that is set in the expression area |
| 88 | + :rtype: str |
| 89 | +%End |
48 | 90 |
|
49 | | - /** Returns the currently selected field or expression. If a field is currently selected, the returned |
50 | | - * value will be converted to a valid expression referencing this field (ie enclosing the field name with |
51 | | - * appropriate quotations). |
52 | | - * @note added in QGIS 2.14 |
53 | | - */ |
54 | 91 | QString asExpression() const; |
| 92 | +%Docstring |
| 93 | + Returns the currently selected field or expression. If a field is currently selected, the returned |
| 94 | + value will be converted to a valid expression referencing this field (ie enclosing the field name with |
| 95 | + appropriate quotations). |
| 96 | +.. versionadded:: 2.14 |
| 97 | + :rtype: str |
| 98 | +%End |
55 | 99 |
|
56 | | - /** |
57 | | - * Returns the currently selected field or expression. If a field is currently selected, the returned |
58 | | - * value will be converted to a valid expression referencing this field (ie enclosing the field name with |
59 | | - * appropriate quotations). |
60 | | - * |
61 | | - * Alias for asExpression() |
62 | | - * |
63 | | - * @note added in QGIS 3.0 |
64 | | - */ |
65 | 100 | QString expression() const; |
| 101 | +%Docstring |
| 102 | + Returns the currently selected field or expression. If a field is currently selected, the returned |
| 103 | + value will be converted to a valid expression referencing this field (ie enclosing the field name with |
| 104 | + appropriate quotations). |
66 | 105 |
|
67 | | - /** |
68 | | - * Returns the layer currently associated with the widget. |
69 | | - * @see setLayer() |
70 | | - */ |
71 | | - QgsVectorLayer* layer() const; |
72 | | - |
73 | | - /** |
74 | | - * Register an expression context generator class that will be used to retrieve |
75 | | - * an expression context for the widget. |
76 | | - * @param generator A QgsExpressionContextGenerator class that will be used to |
77 | | - * create an expression context when required. |
78 | | - * @note added in QGIS 3.0 |
79 | | - */ |
80 | | - void registerExpressionContextGenerator( QgsExpressionContextGenerator* generator ); |
| 106 | + Alias for asExpression() |
81 | 107 |
|
82 | | - signals: |
83 | | - //! the signal is emitted when the currently selected field changes |
84 | | - void fieldChanged( const QString& fieldName ); |
| 108 | +.. versionadded:: 3.0 |
| 109 | + :rtype: str |
| 110 | +%End |
85 | 111 |
|
86 | | - //! fieldChanged signal with indication of the validity of the expression |
87 | | - void fieldChanged( const QString& fieldName, bool isValid ); |
| 112 | + QgsVectorLayer *layer() const; |
| 113 | +%Docstring |
| 114 | + Returns the layer currently associated with the widget. |
| 115 | + \see setLayer() |
| 116 | + :rtype: QgsVectorLayer |
| 117 | +%End |
88 | 118 |
|
89 | | -// void returnPressed(); |
| 119 | + void registerExpressionContextGenerator( const QgsExpressionContextGenerator *generator ); |
| 120 | +%Docstring |
| 121 | + Register an expression context generator class that will be used to retrieve |
| 122 | + an expression context for the widget. |
| 123 | + \param generator A QgsExpressionContextGenerator class that will be used to |
| 124 | + create an expression context when required. |
| 125 | +.. versionadded:: 3.0 |
| 126 | +%End |
| 127 | + |
| 128 | + signals: |
| 129 | + void fieldChanged( const QString &fieldName ); |
| 130 | +%Docstring |
| 131 | +the signal is emitted when the currently selected field changes |
| 132 | +%End |
| 133 | + |
| 134 | + void fieldChanged( const QString &fieldName, bool isValid ); |
| 135 | +%Docstring |
| 136 | +fieldChanged signal with indication of the validity of the expression |
| 137 | +%End |
90 | 138 |
|
91 | 139 | public slots: |
92 | | - /** |
93 | | - * Sets the layer used to display the fields and expression. |
94 | | - * @see layer() |
95 | | - */ |
96 | | - void setLayer( QgsMapLayer* layer ); |
97 | 140 |
|
98 | | - //! sets the current row in the widget |
| 141 | + void setLayer( QgsMapLayer *layer ); |
| 142 | +%Docstring |
| 143 | + Sets the layer used to display the fields and expression. |
| 144 | + \see layer() |
| 145 | +%End |
| 146 | + |
99 | 147 | void setRow( int row ); |
| 148 | +%Docstring |
| 149 | +sets the current row in the widget |
| 150 | +%End |
100 | 151 |
|
101 | | - //! sets the current field or expression in the widget |
102 | 152 | void setField( const QString &fieldName ); |
| 153 | +%Docstring |
| 154 | +sets the current field or expression in the widget |
| 155 | +%End |
| 156 | + |
| 157 | + void setExpression( const QString &expression ); |
| 158 | +%Docstring |
| 159 | + Sets the current expression text and if applicable also the field. |
| 160 | + Alias for setField. |
103 | 161 |
|
104 | | - /** |
105 | | - * Sets the current expression text and if applicable also the field. |
106 | | - * Alias for setField. |
107 | | - * |
108 | | - * @note Added in QGIS 3.0 |
109 | | - */ |
110 | | - void setExpression( const QString& expression ); |
| 162 | +.. versionadded:: 3.0 |
| 163 | +%End |
111 | 164 |
|
112 | 165 | protected slots: |
113 | | - //! open the expression dialog to edit the current or add a new expression |
114 | 166 | void editExpression(); |
| 167 | +%Docstring |
| 168 | +open the expression dialog to edit the current or add a new expression |
| 169 | +%End |
115 | 170 |
|
116 | | - //! when expression is edited by the user in the line edit, it will be checked for validity |
117 | | - void expressionEdited( const QString& expression ); |
| 171 | + void expressionEdited( const QString &expression ); |
| 172 | +%Docstring |
| 173 | +when expression is edited by the user in the line edit, it will be checked for validity |
| 174 | +%End |
118 | 175 |
|
119 | | - //! when expression has been edited (finished) it will be added to the model |
120 | 176 | void expressionEditingFinished(); |
| 177 | +%Docstring |
| 178 | +when expression has been edited (finished) it will be added to the model |
| 179 | +%End |
121 | 180 |
|
122 | 181 | void currentFieldChanged(); |
123 | 182 |
|
124 | | - /** |
125 | | - * @brief updateLineEditStyle will re-style (color/font) the line edit depending on content and status |
126 | | - * @param expression if expression is given it will be evaluated for the given string, otherwise it takes |
127 | | - * current expression from the model |
128 | | - */ |
129 | | - void updateLineEditStyle( const QString& expression = QString() ); |
| 183 | + void updateLineEditStyle( const QString &expression = QString() ); |
| 184 | +%Docstring |
| 185 | + updateLineEditStyle will re-style (color/font) the line edit depending on content and status |
| 186 | + \param expression if expression is given it will be evaluated for the given string, otherwise it takes |
| 187 | + current expression from the model |
| 188 | +%End |
130 | 189 |
|
131 | | - bool isExpressionValid( const QString& expressionStr ); |
| 190 | + bool isExpressionValid( const QString &expressionStr ); |
| 191 | +%Docstring |
| 192 | + :rtype: bool |
| 193 | +%End |
132 | 194 |
|
133 | 195 | protected: |
134 | | - void changeEvent( QEvent* event ); |
| 196 | + virtual void changeEvent( QEvent *event ); |
| 197 | + |
135 | 198 | }; |
| 199 | + |
| 200 | +/************************************************************************ |
| 201 | + * This file has been generated automatically from * |
| 202 | + * * |
| 203 | + * src/gui/qgsfieldexpressionwidget.h * |
| 204 | + * * |
| 205 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 206 | + ************************************************************************/ |
0 commit comments