mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
189 lines
5.7 KiB
Plaintext
189 lines
5.7 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/qgsexpressionpreviewwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsExpressionPreviewWidget : QWidget
|
|
{
|
|
%Docstring(signature="appended")
|
|
A widget for previewing an expression result.
|
|
|
|
If the layer is set, one can browse across features to see the different
|
|
outputs.
|
|
|
|
.. versionadded:: 3.14
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsexpressionpreviewwidget.h"
|
|
%End
|
|
public:
|
|
explicit QgsExpressionPreviewWidget( QWidget *parent = 0 );
|
|
%Docstring
|
|
Constructor
|
|
%End
|
|
|
|
void setLayer( QgsVectorLayer *layer );
|
|
%Docstring
|
|
Sets the layer used in the preview
|
|
%End
|
|
|
|
|
|
void setCustomPreviewGenerator( const QString &label, const QList<QPair<QString, QVariant>> &choices, SIP_PYCALLABLE );
|
|
%Docstring
|
|
Sets the widget to run using a custom preview generator.
|
|
|
|
In this mode, the widget will call a callback function to generate a new
|
|
:py:class:`QgsExpressionContext` as the previewed object changes. This
|
|
can be used to provide custom preview values for different objects (i.e.
|
|
for objects which aren't vector layer features).
|
|
|
|
:param label: The label to display for the combo box presenting choices
|
|
of objects. This should be a representative name, eg
|
|
"Band" if the widget is showing choices of raster layer
|
|
bands
|
|
:param choices: A list of choices to present to the user. Each choice is
|
|
a pair of a human-readable label and a QVariant
|
|
representing the object to preview.
|
|
:param previewContextGenerator: A function which takes a QVariant
|
|
representing the object to preview, and
|
|
returns a
|
|
:py:class:`QgsExpressionContext` to use
|
|
for previewing the object.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
%MethodCode
|
|
Py_XINCREF( a2 );
|
|
Py_BEGIN_ALLOW_THREADS
|
|
sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2]( const QVariant &value ) -> QgsExpressionContext {
|
|
QgsExpressionContext res;
|
|
SIP_BLOCK_THREADS
|
|
PyObject *s = sipCallMethod( NULL, a2, "D", &value, sipType_QVariant, NULL );
|
|
int state;
|
|
int sipIsError = 0;
|
|
QgsExpressionContext *t1 = reinterpret_cast<QgsExpressionContext *>( sipConvertToType( s, sipType_QgsExpressionContext, 0, SIP_NOT_NONE, &state, &sipIsError ) );
|
|
if ( sipIsError == 0 )
|
|
{
|
|
res = QgsExpressionContext( *t1 );
|
|
}
|
|
sipReleaseType( t1, sipType_QgsExpressionContext, state );
|
|
SIP_UNBLOCK_THREADS
|
|
return res;
|
|
} );
|
|
|
|
Py_END_ALLOW_THREADS
|
|
%End
|
|
|
|
void setExpressionText( const QString &expression );
|
|
%Docstring
|
|
Sets the expression
|
|
%End
|
|
|
|
QgsExpressionContext expressionContext() const;
|
|
%Docstring
|
|
Returns the expression context for the widget. The context is used for
|
|
the expression preview result and for populating the list of available
|
|
functions and variables.
|
|
|
|
.. seealso:: :py:func:`setExpressionContext`
|
|
%End
|
|
|
|
void setExpressionContext( const QgsExpressionContext &context );
|
|
%Docstring
|
|
Sets the expression context for the widget. The context is used for the
|
|
expression preview result and to populate the list of available
|
|
functions and variables.
|
|
|
|
:param context: expression context
|
|
%End
|
|
|
|
void setGeomCalculator( const QgsDistanceArea &da );
|
|
%Docstring
|
|
Sets geometry calculator used in distance/area calculations.
|
|
%End
|
|
|
|
bool evalError() const;
|
|
%Docstring
|
|
Will be set to ``True`` if the current expression text reported an eval
|
|
error with the context.
|
|
%End
|
|
|
|
bool parserError() const;
|
|
%Docstring
|
|
Will be set to ``True`` if the current expression text reports a parser
|
|
error with the context.
|
|
%End
|
|
|
|
const QgsExpressionNode *rootNode() const;
|
|
%Docstring
|
|
Returns the root node of the expression
|
|
%End
|
|
|
|
QList<QgsExpression::ParserError> parserErrors() const;
|
|
%Docstring
|
|
Returns the expression parser errors
|
|
%End
|
|
|
|
QString currentPreviewText() const;
|
|
%Docstring
|
|
Returns the current expression result preview text.
|
|
|
|
.. versionadded:: 3.38
|
|
%End
|
|
|
|
signals:
|
|
|
|
void expressionParsed( bool isValid );
|
|
%Docstring
|
|
Emitted when the user changes the expression in the widget. Users of
|
|
this widget should connect to this signal to decide if to let the user
|
|
continue.
|
|
|
|
:param isValid: Is ``True`` if the expression the user has typed is
|
|
valid.
|
|
%End
|
|
|
|
void evalErrorChanged();
|
|
%Docstring
|
|
Will be set to ``True`` if the current expression text reported an eval
|
|
error with the context.
|
|
%End
|
|
|
|
void parserErrorChanged();
|
|
%Docstring
|
|
Will be set to ``True`` if the current expression text reported a parser
|
|
error with the context.
|
|
%End
|
|
|
|
void toolTipChanged( const QString &toolTip );
|
|
%Docstring
|
|
Emitted whenever the tool tip changed
|
|
%End
|
|
|
|
public slots:
|
|
void setCurrentFeature( const QgsFeature &feature );
|
|
%Docstring
|
|
sets the current feature used
|
|
%End
|
|
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/gui/qgsexpressionpreviewwidget.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.py again *
|
|
************************************************************************/
|