22#include <Qsci/qscilexerjson.h>
24#include "moc_qgscodeeditorshell.cpp"
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 )
177const char *QgsQsciLexerBash::language()
const
182const char *QgsQsciLexerBash::lexer()
const
187int QgsQsciLexerBash::lexerId()
const
189 return QsciScintillaBase::SCLEX_BASH;
192QString QgsQsciLexerBash::description(
int style )
const
197 return tr(
"Default" );
199 return tr(
"Error" );
201 return tr(
"Comment" );
203 return tr(
"Number" );
205 return tr(
"Keyword" );
207 return tr(
"String" );
208 case SingleQuotedString:
209 return tr(
"Single Quoted String" );
211 return tr(
"Operator" );
213 return tr(
"Identifier" );
215 return tr(
"Scale Variable" );
217 return tr(
"Parameter" );
218 case BacktickQuotedCommand:
219 return tr(
"Backtick Quoted Command" );
220 case HeredocDelimiter:
221 return tr(
"Heredoc Delimiter" );
222 case HeredocQuotedString:
223 return tr(
"Heredoc Quoted String" );
228const char *QgsQsciLexerBash::keywords(
int set )
const
233 return "case cat do done echo else esac exit export fi find for if in set then while";
240QgsQsciLexerBatch::QgsQsciLexerBatch( QObject *parent )
241 : QsciLexer( parent )
244const char *QgsQsciLexerBatch::language()
const
249const char *QgsQsciLexerBatch::lexer()
const
254int QgsQsciLexerBatch::lexerId()
const
256 return QsciScintillaBase::SCLEX_BATCH;
259QString QgsQsciLexerBatch::description(
int style )
const
264 return tr(
"Default" );
266 return tr(
"Comment" );
270 return tr(
"Label" );
274 return tr(
"Command" );
276 return tr(
"Operator" );
278 return tr(
"Identifier" );
283const char *QgsQsciLexerBatch::keywords(
int set )
const
288 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.
QgsCodeEditor::Mode mode() const
Returns the code editor mode.
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.
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.
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.