QGIS API Documentation
2.8.2-Wien
|
The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions It contains a combo boxto display the fields and expression and a button to open the expression dialog. More...
#include <qgsfieldexpressionwidget.h>
Public Slots | |
void | setField (const QString &fieldName) |
sets the current field or expression in the widget | |
void | setLayer (QgsVectorLayer *layer) |
set the layer used to display the fields and expression | |
void | setLayer (QgsMapLayer *layer) |
convenience slot to connect QgsMapLayerComboBox layer signal |
Signals | |
void | fieldChanged (QString fieldName) |
the signal is emitted when the currently selected field changes | |
void | fieldChanged (QString fieldName, bool isValid) |
fieldChanged signal with indication of the validity of the expression |
Public Member Functions | |
QgsFieldExpressionWidget (QWidget *parent=0) | |
QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog. | |
QString | currentField (bool *isExpression=0, bool *isValid=0) const |
currentField returns the currently selected field or expression if allowed | |
QString | currentText () const |
Return the current text that is set in the expression area. | |
const QString | expressionDialogTitle () |
return the title used for the expression dialog | |
QgsFieldProxyModel::Filters | filters () const |
currently used filter on list of fields | |
bool | isExpression () const |
bool | isValidExpression (QString *expressionError=0) const |
Return true if the current expression is valid. | |
QgsVectorLayer * | layer () const |
Returns the currently used layer. | |
void | setExpressionDialogTitle (QString title) |
define the title used in the expression dialog | |
void | setFilters (QgsFieldProxyModel::Filters filters) |
setFilters allows fitering according to the type of field | |
void | setGeomCalculator (const QgsDistanceArea &da) |
set the geometry calculator used in the expression dialog | |
void | setLeftHandButtonStyle (bool isLeft) |
Protected Slots | |
void | currentFieldChanged () |
void | editExpression () |
open the expression dialog to edit the current or add a new expression | |
void | expressionEdited (const QString expression) |
when expression is edited by the user in the line edit, it will be checked for validity | |
void | expressionEditingFinished () |
when expression has been edited (finished) it will be added to the model | |
bool | isExpressionValid (const QString expressionStr) |
void | updateLineEditStyle (const QString expression=QString()) |
updateLineEditStyle will re-style (color/font) the line edit depending on content and status |
Protected Member Functions | |
void | changeEvent (QEvent *event) override |
Properties | |
QString | expressionDialogTitle |
QgsFieldProxyModel::Filters | filters |
The QgsFieldExpressionWidget class reates a widget to choose fields and edit expressions It contains a combo boxto display the fields and expression and a button to open the expression dialog.
The combo box is editable, allowing expressions to be edited inline. The validity of the expression is checked live on key press, invalid expressions are displayed in red. The expression will be added to the model (and the fieldChanged signals emitted) only when editing in the line edit is finished (focus lost, enter key pressed).
Definition at line 40 of file qgsfieldexpressionwidget.h.
|
explicit |
QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog.
Definition at line 25 of file qgsfieldexpressionwidget.cpp.
|
overrideprotected |
Definition at line 205 of file qgsfieldexpressionwidget.cpp.
QString QgsFieldExpressionWidget::currentField | ( | bool * | isExpression = 0 , |
bool * | isValid = 0 |
||
) | const |
currentField returns the currently selected field or expression if allowed
isExpression | determines if the string returned is the name of a field or an expression |
isValid | determines if the expression (or field) returned is valid |
Definition at line 108 of file qgsfieldexpressionwidget.cpp.
|
protectedslot |
Definition at line 213 of file qgsfieldexpressionwidget.cpp.
QString QgsFieldExpressionWidget::currentText | ( | ) | const |
Return the current text that is set in the expression area.
Definition at line 91 of file qgsfieldexpressionwidget.cpp.
|
protectedslot |
open the expression dialog to edit the current or add a new expression
Definition at line 169 of file qgsfieldexpressionwidget.cpp.
|
inline |
return the title used for the expression dialog
Definition at line 57 of file qgsfieldexpressionwidget.h.
|
protectedslot |
when expression is edited by the user in the line edit, it will be checked for validity
Definition at line 188 of file qgsfieldexpressionwidget.cpp.
|
protectedslot |
when expression has been edited (finished) it will be added to the model
Definition at line 194 of file qgsfieldexpressionwidget.cpp.
|
signal |
the signal is emitted when the currently selected field changes
|
signal |
fieldChanged signal with indication of the validity of the expression
|
inline |
currently used filter on list of fields
Definition at line 65 of file qgsfieldexpressionwidget.h.
bool QgsFieldExpressionWidget::isExpression | ( | ) | const |
Definition at line 103 of file qgsfieldexpressionwidget.cpp.
|
protectedslot |
Definition at line 270 of file qgsfieldexpressionwidget.cpp.
bool QgsFieldExpressionWidget::isValidExpression | ( | QString * | expressionError = 0 | ) | const |
Return true if the current expression is valid.
Definition at line 96 of file qgsfieldexpressionwidget.cpp.
QgsVectorLayer * QgsFieldExpressionWidget::layer | ( | ) | const |
Returns the currently used layer.
Definition at line 122 of file qgsfieldexpressionwidget.cpp.
void QgsFieldExpressionWidget::setExpressionDialogTitle | ( | QString | title | ) |
define the title used in the expression dialog
Definition at line 61 of file qgsfieldexpressionwidget.cpp.
|
slot |
sets the current field or expression in the widget
Definition at line 141 of file qgsfieldexpressionwidget.cpp.
void QgsFieldExpressionWidget::setFilters | ( | QgsFieldProxyModel::Filters | filters | ) |
setFilters allows fitering according to the type of field
Definition at line 66 of file qgsfieldexpressionwidget.cpp.
void QgsFieldExpressionWidget::setGeomCalculator | ( | const QgsDistanceArea & | da | ) |
set the geometry calculator used in the expression dialog
Definition at line 86 of file qgsfieldexpressionwidget.cpp.
|
slot |
set the layer used to display the fields and expression
Definition at line 136 of file qgsfieldexpressionwidget.cpp.
|
slot |
convenience slot to connect QgsMapLayerComboBox layer signal
Definition at line 127 of file qgsfieldexpressionwidget.cpp.
void QgsFieldExpressionWidget::setLeftHandButtonStyle | ( | bool | isLeft | ) |
Definition at line 71 of file qgsfieldexpressionwidget.cpp.
|
protectedslot |
updateLineEditStyle will re-style (color/font) the line edit depending on content and status
expression | if expression is given it will be evaluated for the given string, otherwise it takes current expression from the model |
Definition at line 235 of file qgsfieldexpressionwidget.cpp.
|
readwrite |
Definition at line 43 of file qgsfieldexpressionwidget.h.
|
readwrite |
Definition at line 45 of file qgsfieldexpressionwidget.h.