QGIS API Documentation 3.43.0-Master (32433f7016e)
qgscodeeditorexpression.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscodeeditorexpression.h - A SQL editor based on QScintilla
3 --------------------------------------
4 Date : 06-Oct-2013
5 Copyright : (C) 2013 by Salvatore Larosa
6 Email : lrssvtml (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 QGSCODEEDITOREXPRESSION_H
17#define QGSCODEEDITOREXPRESSION_H
18
19#include "qgis_sip.h"
20#include "qgis_gui.h"
21#include "qgscodeeditor.h"
23
24#include <Qsci/qscilexersql.h>
25
26SIP_IF_MODULE( HAVE_QSCI_SIP )
27
28
37class GUI_EXPORT QgsCodeEditorExpression : public QgsCodeEditor
38{
39 Q_OBJECT
40
41 public:
43 QgsCodeEditorExpression( QWidget *parent SIP_TRANSFERTHIS = nullptr );
44
45 Qgis::ScriptLanguage language() const override;
46 Qgis::ScriptLanguageCapabilities languageCapabilities() const override;
47
53 void setExpressionContext( const QgsExpressionContext &context );
54
58 void setFields( const QgsFields &fields );
59
60 void toggleComment() override;
61
62 protected:
63 void initializeLexer() override;
64
65 private:
66 void updateApis();
67 QsciAPIs *mApis = nullptr;
68 QsciLexerSQL *mSqlLexer = nullptr;
69
70 QStringList mVariables;
71 QStringList mContextFunctions;
72 QStringList mFunctions;
73 QStringList mFieldNames;
74};
75
76#ifndef SIP_RUN
78
88class QgsLexerExpression : public QsciLexerSQL
89{
90 Q_OBJECT
91
92 public:
94 explicit QgsLexerExpression( QObject *parent = nullptr );
95
96 const char *language() const override;
97
98 bool caseSensitive() const override;
99
100 const char *wordCharacters() const override;
101};
102
103class QgsSciApisExpression : public QsciAPIs
104{
105 Q_OBJECT
106 public:
107 QgsSciApisExpression( QsciLexer *lexer );
108
109 QStringList callTips( const QStringList &context, int commas, QsciScintilla::CallTipsStyle style, QList<int> &shifts ) override;
110};
112#endif
113
114#endif
ScriptLanguage
Scripting languages.
Definition qgis.h:4328
QFlags< ScriptLanguageCapability > ScriptLanguageCapabilities
Script language capabilities.
Definition qgis.h:4363
A QGIS expression editor based on QScintilla2.
A text editor based on QScintilla2.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Container of fields for a vector layer.
Definition qgsfields.h:46
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53