18#include "moc_qgscodeeditorshell.cpp"
23#include <Qsci/qscilexerjson.h>
28 , mLanguage( language )
73 QsciLexer *lexer =
nullptr;
101 lexer =
new QgsQsciLexerBash();
104 lexer =
new QgsQsciLexerBatch();
112 lexer->setDefaultFont( font );
113 lexer->setFont( font, -1 );
119 font.setItalic(
true );
120 lexer->setFont( font, QgsQsciLexerBash::LineComment );
144 font.setItalic(
true );
145 lexer->setFont( font, QgsQsciLexerBatch::Comment );
173QgsQsciLexerBash::QgsQsciLexerBash( QObject *parent )
174 : QsciLexer( parent )
178const char *QgsQsciLexerBash::language()
const
183const char *QgsQsciLexerBash::lexer()
const
188int QgsQsciLexerBash::lexerId()
const
190 return QsciScintillaBase::SCLEX_BASH;
193QString QgsQsciLexerBash::description(
int style )
const
198 return tr(
"Default" );
200 return tr(
"Error" );
202 return tr(
"Comment" );
204 return tr(
"Number" );
206 return tr(
"Keyword" );
208 return tr(
"String" );
209 case SingleQuotedString:
210 return tr(
"Single Quoted String" );
212 return tr(
"Operator" );
214 return tr(
"Identifier" );
216 return tr(
"Scale Variable" );
218 return tr(
"Parameter" );
219 case BacktickQuotedCommand:
220 return tr(
"Backtick Quoted Command" );
221 case HeredocDelimiter:
222 return tr(
"Heredoc Delimiter" );
223 case HeredocQuotedString:
224 return tr(
"Heredoc Quoted String" );
229const char *QgsQsciLexerBash::keywords(
int set )
const
234 return "case cat do done echo else esac exit export fi find for if in set then while";
241QgsQsciLexerBatch::QgsQsciLexerBatch( QObject *parent )
242 : QsciLexer( parent )
246const char *QgsQsciLexerBatch::language()
const
251const char *QgsQsciLexerBatch::lexer()
const
256int QgsQsciLexerBatch::lexerId()
const
258 return QsciScintillaBase::SCLEX_BATCH;
261QString QgsQsciLexerBatch::description(
int style )
const
266 return tr(
"Default" );
268 return tr(
"Comment" );
272 return tr(
"Label" );
276 return tr(
"Command" );
278 return tr(
"Operator" );
280 return tr(
"Identifier" );
285const char *QgsQsciLexerBatch::keywords(
int set )
const
290 return "call defined do echo else errorlevel exist exit for goto if in not set";
ScriptLanguage
Scripting languages.
@ QgisExpression
QGIS expressions.
@ Batch
Windows batch files.
@ Unknown
Unknown/other language.
@ CommentBlock
Comment block color.
@ Decoration
Decoration color.
@ Identifier
Identifier color.
@ DoubleQuote
Double quote color.
@ CommentLine
Line comment color.
@ Default
Default text color.
@ Background
Background color.
@ SingleQuote
Single quote color.
@ Operator
Operator color.
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.
A text editor based on QScintilla2.
void runPostLexerConfigurationTasks()
Performs tasks which must be run after a lexer has been set for the widget.
void setTitle(const QString &title)
Set the widget title.
Flag
Flags controlling behavior of code editor.
void setLineNumbersVisible(bool visible)
Sets whether line numbers should be visible in the editor.
QFont lexerFont() const
Returns the font to use in the lexer.
QColor lexerColor(QgsCodeEditorColorScheme::ColorRole role) const
Returns the color to use in the lexer for the specified role.