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>
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
|
Protected Slots |
| 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
|
| void | currentFieldChanged () |
| void | updateLineEditStyle (const QString expression=QString()) |
| | updateLineEditStyle will re-style (color/font) the line edit depending on content and status
|
| bool | isExpressionValid (const QString expressionStr) |
Protected Member Functions |
| void | changeEvent (QEvent *event) |
Detailed Description
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).
Constructor & Destructor Documentation
| QgsFieldExpressionWidget::QgsFieldExpressionWidget |
( |
QWidget * |
parent = 0 | ) |
|
|
explicit |
QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog.
Member Function Documentation
| void QgsFieldExpressionWidget::changeEvent |
( |
QEvent * |
event | ) |
|
|
protected |
| QString QgsFieldExpressionWidget::currentField |
( |
bool * |
isExpression = 0, |
|
|
bool * |
isValid = 0 |
|
) |
| const |
currentField returns the currently selected field or expression if allowed
- Parameters
-
| 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 |
| void QgsFieldExpressionWidget::currentFieldChanged |
( |
| ) |
|
|
protectedslot |
| QString QgsFieldExpressionWidget::currentText |
( |
| ) |
const |
Return the current text that is set in the expression area.
| void QgsFieldExpressionWidget::editExpression |
( |
| ) |
|
|
protectedslot |
open the expression dialog to edit the current or add a new expression
| const QString QgsFieldExpressionWidget::expressionDialogTitle |
( |
| ) |
|
|
inline |
return the title used for the expression dialog
| void QgsFieldExpressionWidget::expressionEdited |
( |
const QString |
expression | ) |
|
|
protectedslot |
when expression is edited by the user in the line edit, it will be checked for validity
| void QgsFieldExpressionWidget::expressionEditingFinished |
( |
| ) |
|
|
protectedslot |
when expression has been edited (finished) it will be added to the model
| void QgsFieldExpressionWidget::fieldChanged |
( |
QString |
fieldName | ) |
|
|
signal |
the signal is emitted when the currently selected field changes
| void QgsFieldExpressionWidget::fieldChanged |
( |
QString |
fieldName, |
|
|
bool |
isValid |
|
) |
| |
|
signal |
fieldChanged signal with indication of the validity of the expression
| QgsFieldProxyModel::Filters QgsFieldExpressionWidget::filters |
( |
| ) |
const |
|
inline |
currently used filter on list of fields
| bool QgsFieldExpressionWidget::isExpression |
( |
| ) |
const |
| bool QgsFieldExpressionWidget::isExpressionValid |
( |
const QString |
expressionStr | ) |
|
|
protectedslot |
| bool QgsFieldExpressionWidget::isValidExpression |
( |
QString * |
expressionError = 0 | ) |
const |
Return true if the current expression is valid.
Returns the currently used layer.
| void QgsFieldExpressionWidget::setExpressionDialogTitle |
( |
QString |
title | ) |
|
define the title used in the expression dialog
| void QgsFieldExpressionWidget::setField |
( |
const QString & |
fieldName | ) |
|
|
slot |
sets the current field or expression in the widget
| void QgsFieldExpressionWidget::setFilters |
( |
QgsFieldProxyModel::Filters |
filters | ) |
|
setFilters allows fitering according to the type of field
| void QgsFieldExpressionWidget::setGeomCalculator |
( |
const QgsDistanceArea & |
da | ) |
|
set the geometry calculator used in the expression dialog
set the layer used to display the fields and expression
| void QgsFieldExpressionWidget::setLayer |
( |
QgsMapLayer * |
layer | ) |
|
|
slot |
| void QgsFieldExpressionWidget::setLeftHandButtonStyle |
( |
bool |
isLeft | ) |
|
| void QgsFieldExpressionWidget::updateLineEditStyle |
( |
const QString |
expression = QString() | ) |
|
|
protectedslot |
updateLineEditStyle will re-style (color/font) the line edit depending on content and status
- Parameters
-
| expression | if expression is given it will be evaluated for the given string, otherwise it takes current expression from the model |
Property Documentation
| QString QgsFieldExpressionWidget::expressionDialogTitle |
|
readwrite |
| QgsFieldProxyModel::Filters QgsFieldExpressionWidget::filters |
|
readwrite |
The documentation for this class was generated from the following files: