QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
qgscodeeditorsql.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscodeeditorsql.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 QGSCODEEDITORSQL_H
17#define QGSCODEEDITORSQL_H
18
19#include "qgscodeeditor.h"
20#include "qgis_sip.h"
21#include "qgis_gui.h"
22#include "qgsfeature.h"
23#include <Qsci/qscilexersql.h>
24
25SIP_IF_MODULE( HAVE_QSCI_SIP )
26
27
34class GUI_EXPORT QgsCodeEditorSQL : public QgsCodeEditor
35{
36 Q_OBJECT
37
38 public:
40 QgsCodeEditorSQL( QWidget *parent SIP_TRANSFERTHIS = nullptr );
41
42 Qgis::ScriptLanguage language() const override;
43
44 virtual ~QgsCodeEditorSQL();
45
51 void setFields( const QgsFields &fields );
52
58 void setFieldNames( const QStringList &fieldNames );
59
64 QStringList fieldNames() const;
65
75 void setExtraKeywords( const QStringList &extraKeywords );
76
86 QStringList extraKeywords() const;
87
88 protected:
89 void initializeLexer() override;
90
91 private:
92 void updateApis();
93 QsciAPIs *mApis = nullptr;
94 QsciLexerSQL *mSqlLexer = nullptr;
95 QSet<QString> mExtraKeywords;
96
97 QSet<QString> mFieldNames;
98
99 friend class TestQgsQueryResultWidget;
100};
101
102#ifndef SIP_RUN
104
114class QgsCaseInsensitiveLexerSQL: public QsciLexerSQL
115{
116 Q_OBJECT
117
118 public:
120 explicit QgsCaseInsensitiveLexerSQL( QObject *parent = nullptr ) : QsciLexerSQL( parent ) {}
121
122 bool caseSensitive() const override { return false; }
123};
125#endif
126
127#endif
ScriptLanguage
Scripting languages.
Definition: qgis.h:2715
A SQL editor based on QScintilla2.
A text editor based on QScintilla2.
Definition: qgscodeeditor.h:93
Container of fields for a vector layer.
Definition: qgsfields.h:45
#define SIP_IF_MODULE(condition)
Definition: qgis_sip.h:28
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53