QGIS API Documentation 4.1.0-Master (60fea48833c)
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:
38 QgsVectorLayer *layer, const QString &startText = QString(), QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &key = "generic", const QgsExpressionContext &context = QgsExpressionContext()
39 );
40
43
44 void setExpressionText( const QString &text );
45
46 QString expressionText();
47
54 QString expectedOutputFormat();
55
61 void setExpectedOutputFormat( const QString &expected );
62
69
76 void setExpressionContext( const QgsExpressionContext &context );
77
79 void setGeomCalculator( const QgsDistanceArea &da );
80
86 bool allowEvalErrors() const;
87
94
95 signals:
96
103
104 protected:
111 void done( int r ) override;
112
113 void accept() override;
114 void reject() override;
115
116 private:
117 const QString mInitialText;
118 QString mRecentKey;
119 bool mAllowEvalErrors = false;
120
121 private slots:
122 void showHelp();
123 void syncOkButtonEnabledState();
124};
125
126// clazy:excludeall=qstring-allocations
127
128#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:52