QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsexpressionbuilderdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgisexpressionbuilderdialog.h - A generic expression builder dialog.
3 --------------------------------------
4 Date : 29-May-2011
5 Copyright : (C) 2011 by Nathan Woodrow
6 Email : woodrow.nathan at gmail dot com
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 QGSEXPRESSIONBUILDERDIALOG_H
17#define QGSEXPRESSIONBUILDERDIALOG_H
18
19#include "ui_qgsexpressionbuilderdialogbase.h"
20
21#include "qgis_gui.h"
22#include "qgshelp.h"
23
24#include <QDialog>
25
30class GUI_EXPORT QgsExpressionBuilderDialog : public QDialog, private Ui::QgsExpressionBuilderDialogBase
31{
32 Q_OBJECT
33
35
36 public:
37 QgsExpressionBuilderDialog( QgsVectorLayer *layer, const QString &startText = QString(), QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &key = "generic", const QgsExpressionContext &context = QgsExpressionContext() );
38
41
42 void setExpressionText( const QString &text );
43
44 QString expressionText();
45
52 QString expectedOutputFormat();
53
59 void setExpectedOutputFormat( const QString &expected );
60
67
74 void setExpressionContext( const QgsExpressionContext &context );
75
77 void setGeomCalculator( const QgsDistanceArea &da );
78
84 bool allowEvalErrors() const;
85
92
93 signals:
94
101
102 protected:
109 void done( int r ) override;
110
111 void accept() override;
112 void reject() override;
113
114 private:
115 const QString mInitialText;
116 QString mRecentKey;
117 bool mAllowEvalErrors = false;
118
119 private slots:
120 void showHelp();
121 void syncOkButtonEnabledState();
122};
123
124// clazy:excludeall=qstring-allocations
125
126#endif
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
void done(int r) override
Is called when the dialog get accepted or rejected Used to save geometry.
void setGeomCalculator(const QgsDistanceArea &da)
Sets geometry calculator used in distance/area calculations.
QgsExpressionBuilderDialog(QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent SIP_TRANSFERTHIS=nullptr, const QString &key="generic", const QgsExpressionContext &context=QgsExpressionContext())
void setExpressionText(const QString &text)
void setExpectedOutputFormat(const QString &expected)
Set the expected format string, which is shown in the dialog.
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
void allowEvalErrorsChanged()
Allow accepting expressions with evaluation errors.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context for the dialog.
void setAllowEvalErrors(bool allowEvalErrors)
Allow accepting expressions with evaluation errors.
QString expectedOutputFormat()
Returns the expected format string, which is shown in the dialog.
QgsExpressionContext expressionContext() const
Returns the expression context for the dialog.
A reusable widget that can be used to build an expression string.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Represents a vector layer which manages a vector based dataset.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53