18#include "moc_qgscodeeditorshell.cpp"
23#include <Qsci/qscilexerjson.h>
33 , mLanguage( language )
78 QsciLexer *lexer =
nullptr;
106 lexer =
new QgsQsciLexerBash();
109 lexer =
new QgsQsciLexerBatch();
117 lexer->setDefaultFont( font );
118 lexer->setFont( font, -1 );
124 font.setItalic(
true );
125 lexer->setFont( font, QgsQsciLexerBash::LineComment );
149 font.setItalic(
true );
150 lexer->setFont( font, QgsQsciLexerBatch::Comment );
178QgsQsciLexerBash::QgsQsciLexerBash( QObject *parent )
179 : QsciLexer( parent )
184const char *QgsQsciLexerBash::language()
const
189const char *QgsQsciLexerBash::lexer()
const
194int QgsQsciLexerBash::lexerId()
const
196 return QsciScintillaBase::SCLEX_BASH;
199QString QgsQsciLexerBash::description(
int style )
const
204 return tr(
"Default" );
206 return tr(
"Error" );
208 return tr(
"Comment" );
210 return tr(
"Number" );
212 return tr(
"Keyword" );
214 return tr(
"String" );
215 case SingleQuotedString:
216 return tr(
"Single Quoted String" );
218 return tr(
"Operator" );
220 return tr(
"Identifier" );
222 return tr(
"Scale Variable" );
224 return tr(
"Parameter" );
225 case BacktickQuotedCommand:
226 return tr(
"Backtick Quoted Command" );
227 case HeredocDelimiter:
228 return tr(
"Heredoc Delimiter" );
229 case HeredocQuotedString:
230 return tr(
"Heredoc Quoted String" );
235const char *QgsQsciLexerBash::keywords(
int set )
const
240 return "case cat do done echo else esac exit export fi find for if in set then while";
248QgsQsciLexerBatch::QgsQsciLexerBatch( QObject *parent )
249 : QsciLexer( parent )
254const char *QgsQsciLexerBatch::language()
const
259const char *QgsQsciLexerBatch::lexer()
const
264int QgsQsciLexerBatch::lexerId()
const
266 return QsciScintillaBase::SCLEX_BATCH;
269QString QgsQsciLexerBatch::description(
int style )
const
274 return tr(
"Default" );
276 return tr(
"Comment" );
280 return tr(
"Label" );
284 return tr(
"Command" );
286 return tr(
"Operator" );
288 return tr(
"Identifier" );
293const char *QgsQsciLexerBatch::keywords(
int set )
const
298 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.