QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
src
gui
qgsexpressionpreviewwidget.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsexpressionpreviewwidget.h
3
--------------------------------------
4
Date : march 2020 - quarantine day 12
5
Copyright : (C) 2020 by Denis Rouzaud
6
Email :
[email protected]
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSEXPRESSIONPREVIEWWIDGET_H
17
#define QGSEXPRESSIONPREVIEWWIDGET_H
18
19
#include <QWidget>
20
21
#include "ui_qgsexpressionpreviewbase.h"
22
23
#include "qgis_gui.h"
24
#include "
qgsdistancearea.h
"
25
26
class
QAction;
27
class
QgsVectorLayer
;
28
35
class
GUI_EXPORT
QgsExpressionPreviewWidget
:
public
QWidget,
private
Ui::QgsExpressionPreviewWidgetBase
36
{
37
Q_OBJECT
38
public
:
40
explicit
QgsExpressionPreviewWidget
( QWidget *parent =
nullptr
);
41
43
void
setLayer(
QgsVectorLayer
*layer );
44
46
void
setExpressionText(
const
QString &expression );
47
53
QgsExpressionContext
expressionContext
()
const
{
return
mExpressionContext; }
54
60
void
setExpressionContext(
const
QgsExpressionContext
&context );
61
63
void
setGeomCalculator(
const
QgsDistanceArea
&da );
64
69
bool
evalError()
const
;
70
75
bool
parserError()
const
;
76
78
const
QgsExpressionNode
*
rootNode
()
const
{
return
mExpression.rootNode();}
79
81
QList<QgsExpression::ParserError>
parserErrors
()
const
{
return
mExpression.parserErrors();}
82
83
signals:
84
91
void
expressionParsed(
bool
isValid );
92
97
void
evalErrorChanged();
98
103
void
parserErrorChanged();
104
106
void
toolTipChanged(
const
QString &toolTip );
107
108
public
slots:
110
void
setCurrentFeature(
const
QgsFeature
&feature );
111
112
113
private
slots:
114
void
linkActivated(
const
QString & );
115
void
setEvalError(
bool
evalError );
116
void
setParserError(
bool
parserError );
117
void
copyFullExpressionValue();
118
119
private
:
120
void
setExpressionToolTip(
const
QString &toolTip );
121
void
refreshPreview();
122
123
QgsVectorLayer
*mLayer =
nullptr
;
124
QgsExpressionContext
mExpressionContext;
125
QgsDistanceArea
mDa;
126
bool
mUseGeomCalculator =
false
;
127
QString mToolTip;
128
bool
mEvalError =
true
;
129
bool
mParserError =
true
;
130
QString mExpressionText;
131
QgsExpression
mExpression;
132
QAction *mCopyPreviewAction =
nullptr
;
133
};
134
135
#endif // QGSEXPRESSIONPREVIEWWIDGET_H
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:406
QgsExpressionPreviewWidget::parserErrors
QList< QgsExpression::ParserError > parserErrors() const
Returns the expression parser erros.
Definition:
qgsexpressionpreviewwidget.h:81
QgsExpressionPreviewWidget
QgsExpressionPreviewWidget is a widget to preview an expression result. If the layer is set,...
Definition:
qgsexpressionpreviewwidget.h:35
QgsExpressionNode
Abstract base class for all nodes that can appear in an expression.
Definition:
qgsexpressionnode.h:34
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:391
QgsExpressionPreviewWidget::rootNode
const QgsExpressionNode * rootNode() const
Returns the root node of the expression.
Definition:
qgsexpressionpreviewwidget.h:78
QgsDistanceArea
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
Definition:
qgsdistancearea.h:52
qgsdistancearea.h
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition:
qgsfeature.h:55
QgsExpressionPreviewWidget::expressionContext
QgsExpressionContext expressionContext() const
Returns the expression context for the widget.
Definition:
qgsexpressionpreviewwidget.h:53
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings")....
Definition:
qgsexpression.h:102
Generated on Sun Sep 11 2022 00:03:17 for QGIS API Documentation by
1.8.17