17#ifndef QGSCODEEDITOR_H
18#define QGSCODEEDITOR_H
26#include <Qsci/qsciapis.h>
51 int exec(
const QString &command );
140 CodeFolding = 1 << 0,
141 ImmediatelyUpdateHistory = 1 << 1,
169 void setTitle( const QString &title );
176 virtual
Qgis::ScriptLanguage language() const;
183 virtual
Qgis::ScriptLanguageCapabilities languageCapabilities() const;
190 static QString languageToString(
Qgis::ScriptLanguage language );
197 Q_DECL_DEPRECATED
void setMarginVisible(
bool margin )
SIP_DEPRECATED;
213 void setLineNumbersVisible(
bool visible );
221 bool lineNumbersVisible()
const;
227 void setFoldingVisible(
bool folding );
233 bool foldingVisible();
240 void insertText(
const QString &text );
284 static QFont getMonospaceFont();
293 void setCustomAppearance(
const QString &scheme = QString(),
const QMap< QgsCodeEditorColorScheme::ColorRole, QColor > &customColors = QMap< QgsCodeEditorColorScheme::ColorRole, QColor >(),
const QString &fontFamily = QString(),
int fontSize = 0 )
SIP_SKIP;
301 void addWarning(
int lineNumber, const QString &warning );
309 void clearWarnings();
323 bool isCursorOnLastLine()
const;
333 void setHistoryFilePath(
const QString &path );
342 QStringList history()
const;
366 int linearPosition()
const;
373 void setLinearPosition(
int position );
382 int selectionStart()
const;
391 int selectionEnd()
const;
398 void setLinearSelection(
int start,
int end );
412 void runCommand(
const QString &command,
bool skipHistory =
false );
420 virtual void moveCursorToStart();
428 virtual void moveCursorToEnd();
437 void showPreviousCommand();
446 void showNextCommand();
462 void removeHistoryCommand(
int index );
471 void clearSessionHistory();
480 void clearPersistentHistory();
487 bool writeHistoryFile();
505 virtual bool checkSyntax();
514 virtual void toggleComment();
537 static bool isFixedPitch(
const QFont &font );
539 void focusOutEvent( QFocusEvent *event )
override;
540 void keyPressEvent( QKeyEvent *event )
override;
541 void contextMenuEvent( QContextMenuEvent *event )
override;
542 bool eventFilter( QObject *watched, QEvent *event )
override;
551 virtual void initializeLexer();
565 QFont lexerFont()
const;
572 void runPostLexerConfigurationTasks();
579 void updateSoftHistory();
599 virtual void populateContextMenu( QMenu *menu );
608 virtual QString reformatCodeString(
const QString &
string );
617 virtual void showMessage(
const QString &title,
const QString &message,
Qgis::MessageLevel level );
622 void updateFolding();
623 bool readHistoryFile();
624 void syncSoftHistory();
625 void updateHistory(
const QStringList &commands,
bool skipSoftHistory =
false );
627 QString mWidgetTitle;
628 bool mMargin =
false;
632 bool mUseDefaultSettings =
true;
634 bool mOverrideColors =
false;
635 QString mColorScheme;
636 QMap< QgsCodeEditorColorScheme::ColorRole, QColor > mCustomColors;
640 QVector< int > mWarningLines;
643 QStringList mHistory;
644 QStringList mSoftHistory;
645 int mSoftHistoryIndex = 0;
646 QString mHistoryFilePath;
650 static QMap< QgsCodeEditorColorScheme::ColorRole, QString > sColorRoleToSettingsKey;
652 static constexpr int MARKER_NUMBER = 6;
The Qgis class provides global constants for use throughout the application.
MessageLevel
Level for messages This will be used both for message log and message bar in application.
A text editor based on QScintilla2.
void sessionHistoryCleared()
Emitted when the history of commands run in the current session is cleared.
@ ScriptEditor
Standard mode, allows for display and edit of entire scripts.
QFlags< Flag > Flags
Flags controlling behavior of code editor.
void persistentHistoryCleared()
Emitted when the persistent history of commands run in the editor is cleared.
Flag
Flags controlling behavior of code editor.
An interface for code interpreters.
virtual int execCommandImpl(const QString &command)=0
Pure virtual method for executing commands in the interpreter.
virtual int currentState() const
Returns the current interpreter state.
virtual QString promptForState(int state) const =0
Returns the interactive prompt string to use for the interpreter, given a state.
virtual ~QgsCodeInterpreter()
QgsSettingsTreeNode is a tree node for the settings tree to help organizing and introspecting the tre...
QgsSettingsTreeNode * createChildNode(const QString &key)
Creates a normal tree node It will return the existing child node if it exists at the given key.
static QgsSettingsTreeNode * sTreeGui
#define SIP_IF_MODULE(condition)
#define SIP_ENUM_BASETYPE(type)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)