QGIS/python/gui/qgsfieldexpressionwidget.sip

208 lines
6.2 KiB
Plaintext
Raw Normal View History

2017-04-19 14:10:50 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfieldexpressionwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsFieldExpressionWidget : QWidget
{
2017-04-19 14:10:50 +02:00
%Docstring
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).
%End
%TypeHeaderCode
#include "qgsfieldexpressionwidget.h"
%End
public:
2017-04-19 14:10:50 +02:00
explicit QgsFieldExpressionWidget( QWidget *parent /TransferThis/ = 0 );
2017-04-19 14:10:50 +02:00
%Docstring
QgsFieldExpressionWidget creates a widget with a combo box to display the fields and expression and a button to open the expression dialog
%End
2017-04-19 14:10:50 +02:00
void setExpressionDialogTitle( const QString &title );
%Docstring
define the title used in the expression dialog
%End
2014-05-18 15:22:26 +02:00
const QString expressionDialogTitle();
2017-04-19 14:10:50 +02:00
%Docstring
return the title used for the expression dialog
:rtype: str
%End
2014-05-18 15:22:26 +02:00
void setFilters( QgsFieldProxyModel::Filters filters );
2017-04-19 14:10:50 +02:00
%Docstring
setFilters allows fitering according to the type of field
%End
2014-06-14 11:47:05 +02:00
void setLeftHandButtonStyle( bool isLeft );
2014-09-01 16:45:54 +02:00
QgsFieldProxyModel::Filters filters() const;
2017-04-19 14:10:50 +02:00
%Docstring
currently used filter on list of fields
:rtype: QgsFieldProxyModel.Filters
%End
void setGeomCalculator( const QgsDistanceArea &da );
2017-04-19 14:10:50 +02:00
%Docstring
set the geometry calculator used in the expression dialog
%End
2014-05-18 15:22:26 +02:00
2014-09-01 16:45:54 +02:00
QString currentField( bool *isExpression = 0, bool *isValid = 0 ) const;
2017-04-19 14:10:50 +02:00
%Docstring
currentField returns the currently selected field or expression if allowed
\param isExpression determines if the string returned is the name of a field or an expression
\param isValid determines if the expression (or field) returned is valid
:rtype: str
%End
2014-09-01 16:45:54 +02:00
bool isValidExpression( QString *expressionError = 0 ) const;
2017-04-19 14:10:50 +02:00
%Docstring
Return true if the current expression is valid
:rtype: bool
%End
2014-06-14 11:47:05 +02:00
2014-09-01 16:45:54 +02:00
bool isExpression() const;
2017-04-19 14:10:50 +02:00
%Docstring
If the content is not just a simple field this method will return true.
:rtype: bool
%End
2014-09-01 16:45:54 +02:00
QString currentText() const;
2017-04-19 14:10:50 +02:00
%Docstring
Return the current text that is set in the expression area
:rtype: str
%End
2014-06-14 11:47:05 +02:00
QString asExpression() const;
2017-04-19 14:10:50 +02:00
%Docstring
Returns the currently selected field or expression. If a field is currently selected, the returned
value will be converted to a valid expression referencing this field (ie enclosing the field name with
appropriate quotations).
.. versionadded:: 2.14
:rtype: str
%End
2016-09-09 09:49:25 +02:00
QString expression() const;
2017-04-19 14:10:50 +02:00
%Docstring
Returns the currently selected field or expression. If a field is currently selected, the returned
value will be converted to a valid expression referencing this field (ie enclosing the field name with
appropriate quotations).
2016-09-09 09:49:25 +02:00
2017-04-19 14:10:50 +02:00
Alias for asExpression()
2017-04-19 14:10:50 +02:00
.. versionadded:: 3.0
:rtype: str
%End
2014-05-02 10:32:37 +02:00
2017-04-19 14:10:50 +02:00
QgsVectorLayer *layer() const;
%Docstring
Returns the layer currently associated with the widget.
\see setLayer()
:rtype: QgsVectorLayer
%End
2017-04-19 14:10:50 +02:00
void registerExpressionContextGenerator( const QgsExpressionContextGenerator *generator );
%Docstring
Register an expression context generator class that will be used to retrieve
an expression context for the widget.
\param generator A QgsExpressionContextGenerator class that will be used to
create an expression context when required.
.. versionadded:: 3.0
%End
signals:
void fieldChanged( const QString &fieldName );
%Docstring
the signal is emitted when the currently selected field changes
%End
void fieldChanged( const QString &fieldName, bool isValid );
%Docstring
fieldChanged signal with indication of the validity of the expression
%End
2014-06-14 11:47:05 +02:00
public slots:
2017-04-19 14:10:50 +02:00
void setLayer( QgsMapLayer *layer );
%Docstring
Sets the layer used to display the fields and expression.
\see layer()
%End
void setRow( int row );
2017-04-19 14:10:50 +02:00
%Docstring
sets the current row in the widget
%End
2014-05-18 15:22:26 +02:00
void setField( const QString &fieldName );
2017-04-19 14:10:50 +02:00
%Docstring
sets the current field or expression in the widget
%End
void setExpression( const QString &expression );
%Docstring
Sets the current expression text and if applicable also the field.
Alias for setField.
2014-05-27 23:22:50 +02:00
2017-04-19 14:10:50 +02:00
.. versionadded:: 3.0
%End
2016-09-09 09:49:25 +02:00
2014-05-27 23:22:50 +02:00
protected slots:
void editExpression();
2017-04-19 14:10:50 +02:00
%Docstring
open the expression dialog to edit the current or add a new expression
%End
2014-05-27 23:22:50 +02:00
2017-04-19 14:10:50 +02:00
void expressionEdited( const QString &expression );
%Docstring
when expression is edited by the user in the line edit, it will be checked for validity
%End
2014-05-27 23:22:50 +02:00
void expressionEditingFinished();
2017-04-19 14:10:50 +02:00
%Docstring
when expression has been edited (finished) it will be added to the model
%End
2014-05-27 23:22:50 +02:00
void currentFieldChanged();
2014-05-27 23:22:50 +02:00
2017-04-19 14:10:50 +02:00
void updateLineEditStyle( const QString &expression = QString() );
%Docstring
updateLineEditStyle will re-style (color/font) the line edit depending on content and status
\param expression if expression is given it will be evaluated for the given string, otherwise it takes
current expression from the model
%End
2014-05-27 23:22:50 +02:00
2017-04-19 14:10:50 +02:00
bool isExpressionValid( const QString &expressionStr );
%Docstring
:rtype: bool
%End
2014-05-27 23:22:50 +02:00
protected:
2017-04-19 14:10:50 +02:00
virtual void changeEvent( QEvent *event );
2017-04-20 13:48:50 +02:00
};
2017-04-19 14:10:50 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgsfieldexpressionwidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/