QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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 "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgscodeeditor.h"
22#include "qgsfeature.h"
23
24#include <Qsci/qscilexersql.h>
25
26SIP_IF_MODULE( HAVE_QSCI_SIP )
27
28
35class GUI_EXPORT QgsCodeEditorSQL : public QgsCodeEditor
36{
37 Q_OBJECT
38
39 public:
41 QgsCodeEditorSQL( QWidget *parent SIP_TRANSFERTHIS = nullptr );
42
43 Qgis::ScriptLanguage language() const override;
44
45 ~QgsCodeEditorSQL() override;
46
52 void setFields( const QgsFields &fields );
53
59 void setFieldNames( const QStringList &fieldNames );
60
65 QStringList fieldNames() const;
66
76 void setExtraKeywords( const QStringList &extraKeywords );
77
87 QStringList extraKeywords() const;
88
89 protected:
90 void initializeLexer() override;
91
92 private:
93 void updateApis();
94 QsciAPIs *mApis = nullptr;
95 QsciLexerSQL *mSqlLexer = nullptr;
96 QSet<QString> mExtraKeywords;
97
98 QSet<QString> mFieldNames;
99
101};
102
103#ifndef SIP_RUN
105
115class QgsCaseInsensitiveLexerSQL : public QsciLexerSQL
116{
117 Q_OBJECT
118
119 public:
121 explicit QgsCaseInsensitiveLexerSQL( QObject *parent = nullptr )
122 : QsciLexerSQL( parent ) {}
123
124 bool caseSensitive() const override { return false; }
125};
127#endif
128
129#endif
ScriptLanguage
Scripting languages.
Definition qgis.h:4478
QStringList extraKeywords() const
Returns the extra keywords.
Qgis::ScriptLanguage language() const override
Returns the associated scripting language.
friend class TestQgsQueryResultWidget
void setExtraKeywords(const QStringList &extraKeywords)
Set extra keywords to extraKeywords.
QStringList fieldNames() const
Returns field names from the lexer API.
QgsCodeEditorSQL(QWidget *parent=nullptr)
Constructor for QgsCodeEditorSQL.
void setFieldNames(const QStringList &fieldNames)
Set field names to fieldNames to be added to the lexer API.
void initializeLexer() override
Called when the dialect specific code lexer needs to be initialized (or reinitialized).
void setFields(const QgsFields &fields)
Set field names to be added to the lexer API.
QgsCodeEditor(QWidget *parent=nullptr, const QString &title=QString(), bool folding=false, bool margin=false, QgsCodeEditor::Flags flags=QgsCodeEditor::Flags(), QgsCodeEditor::Mode mode=QgsCodeEditor::Mode::ScriptEditor)
Construct a new code editor.
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