QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
qgscodeeditorshell.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscodeeditorshell.h
3 -------------------
4 Date : April 2023
5 Copyright : (C) 2023 by Nyall Dawson
6 Email : nyall dot dawson 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 QGSCODEEDITORSHELL_H
17#define QGSCODEEDITORSHELL_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgscodeeditor.h"
22
23#include <Qsci/qscilexer.h>
24
25SIP_IF_MODULE( HAVE_QSCI_SIP )
26
27#ifndef SIP_RUN
28
30class GUI_EXPORT QgsQsciLexerBash : public QsciLexer
31{
32 Q_OBJECT
33 public:
34 enum Styles
35 {
36 Default = 0, // whitespace
37 Error = 1,
38 LineComment = 2,
39 Number = 3, // numeric literal
40 Keyword = 4,
41 String = 5, // string literal
42 SingleQuotedString = 6, // string literal
43 Operator = 7,
44 Identifier = 8,
45 ScalarVariable = 9, // identifier
46 Parameter = 10, // identifier
47 BacktickQuotedCommand = 11, // string literal
48 HeredocDelimiter = 12, // operator
49 HeredocQuotedString = 13 // string literal
50 };
51
52 QgsQsciLexerBash( QObject *parent = nullptr );
53 const char *language() const override;
54 const char *lexer() const override;
55 int lexerId() const override;
56 QString description( int style ) const override;
57 const char *keywords( int set ) const override;
58};
59
60class GUI_EXPORT QgsQsciLexerBatch : public QsciLexer
61{
62 Q_OBJECT
63 public:
64 enum Styles
65 {
66 Default = 0, // whitespace
67 Comment = 1, // "Fake label"
68 Word = 2, // keyword
69 Label = 3, // "real label"
70 Hide = 4, // hide command -- @echo off/on
71 Command = 5, // external command/program
72 Identifier = 6, // argument / variable
73 Operator = 7,
74 };
75
76 QgsQsciLexerBatch( QObject *parent = nullptr );
77 const char *language() const override;
78 const char *lexer() const override;
79 int lexerId() const override;
80 QString description( int style ) const override;
81 const char *keywords( int set ) const override;
82};
84#endif
85
98class GUI_EXPORT QgsCodeEditorShell : public QgsCodeEditor
99{
100 Q_OBJECT
101
102 public:
103
112 Qgis::ScriptLanguage language() const override;
113
114 protected:
115 void initializeLexer() override;
116
117 private:
119};
120
121#endif // QGSCODEEDITORSHELL_H
ScriptLanguage
Scripting languages.
Definition qgis.h:4478
@ Unknown
Unknown/other language.
Definition qgis.h:4489
void initializeLexer() override
Called when the dialect specific code lexer needs to be initialized (or reinitialized).
Qgis::ScriptLanguage language() const override
Returns the associated scripting language.
QgsCodeEditorShell(QWidget *parent=nullptr, QgsCodeEditor::Mode mode=QgsCodeEditor::Mode::ScriptEditor, Qgis::ScriptLanguage language=Qgis::ScriptLanguage::Unknown)
Constructor for QgsCodeEditorShell.
QgsCodeEditor::Mode mode() const
Returns the code editor mode.
Mode
Code editor modes.
@ ScriptEditor
Standard mode, allows for display and edit of entire scripts.
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.
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53