QGIS API Documentation
3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
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
#include "
qgsexpression.h
"
26
#include "
qgsexpressioncontext.h
"
27
28
class
QAction;
29
class
QgsVectorLayer
;
30
37
class
GUI_EXPORT
QgsExpressionPreviewWidget
:
public
QWidget,
private
Ui::QgsExpressionPreviewWidgetBase
38
{
39
Q_OBJECT
40
public
:
42
explicit
QgsExpressionPreviewWidget
( QWidget *parent =
nullptr
);
43
45
void
setLayer(
QgsVectorLayer
*layer );
46
48
void
setExpressionText(
const
QString &expression );
49
55
QgsExpressionContext
expressionContext
()
const
{
return
mExpressionContext; }
56
62
void
setExpressionContext(
const
QgsExpressionContext
&context );
63
65
void
setGeomCalculator(
const
QgsDistanceArea
&da );
66
71
bool
evalError()
const
;
72
77
bool
parserError()
const
;
78
80
const
QgsExpressionNode
*
rootNode
()
const
{
return
mExpression.rootNode();}
81
83
QList<QgsExpression::ParserError>
parserErrors
()
const
{
return
mExpression.parserErrors();}
84
85
signals:
86
93
void
expressionParsed
(
bool
isValid );
94
99
void
evalErrorChanged
();
100
105
void
parserErrorChanged
();
106
108
void
toolTipChanged
(
const
QString &toolTip );
109
110
public
slots:
112
void
setCurrentFeature(
const
QgsFeature
&feature );
113
114
115
private
slots:
116
void
linkActivated(
const
QString & );
117
void
setEvalError(
bool
evalError );
118
void
setParserError(
bool
parserError );
119
void
copyFullExpressionValue();
120
121
private
:
122
void
setExpressionToolTip(
const
QString &toolTip );
123
void
refreshPreview();
124
125
QgsVectorLayer
*mLayer =
nullptr
;
126
QgsExpressionContext
mExpressionContext;
127
QgsDistanceArea
mDa;
128
bool
mUseGeomCalculator =
false
;
129
QString mToolTip;
130
bool
mEvalError =
true
;
131
bool
mParserError =
true
;
132
QString mExpressionText;
133
QgsExpression
mExpression;
134
QAction *mCopyPreviewAction =
nullptr
;
135
};
136
137
#endif
// QGSEXPRESSIONPREVIEWWIDGET_H
QgsDistanceArea
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
Definition
qgsdistancearea.h:53
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition
qgsexpressioncontext.h:471
QgsExpressionNode
Abstract base class for all nodes that can appear in an expression.
Definition
qgsexpressionnode.h:35
QgsExpressionPreviewWidget
QgsExpressionPreviewWidget is a widget to preview an expression result.
Definition
qgsexpressionpreviewwidget.h:38
QgsExpressionPreviewWidget::rootNode
const QgsExpressionNode * rootNode() const
Returns the root node of the expression.
Definition
qgsexpressionpreviewwidget.h:80
QgsExpressionPreviewWidget::parserErrorChanged
void parserErrorChanged()
Will be set to true if the current expression text reported a parser error with the context.
QgsExpressionPreviewWidget::parserErrors
QList< QgsExpression::ParserError > parserErrors() const
Returns the expression parser erros.
Definition
qgsexpressionpreviewwidget.h:83
QgsExpressionPreviewWidget::expressionContext
QgsExpressionContext expressionContext() const
Returns the expression context for the widget.
Definition
qgsexpressionpreviewwidget.h:55
QgsExpressionPreviewWidget::evalErrorChanged
void evalErrorChanged()
Will be set to true if the current expression text reported an eval error with the context.
QgsExpressionPreviewWidget::toolTipChanged
void toolTipChanged(const QString &toolTip)
Emitted whenever the tool tip changed.
QgsExpressionPreviewWidget::expressionParsed
void expressionParsed(bool isValid)
Emitted when the user changes the expression in the widget.
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings").
Definition
qgsexpression.h:190
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:56
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition
qgsvectorlayer.h:400
qgsdistancearea.h
qgsexpression.h
qgsexpressioncontext.h
Generated on Mon Feb 26 2024 10:02:44 for QGIS API Documentation by
1.9.8