17#ifndef QGSCODEEDITOR_H
18#define QGSCODEEDITOR_H
26#include <Qsci/qsciapis.h>
51 int exec(
const QString &command );
141 CodeFolding = 1 << 0,
142 ImmediatelyUpdateHistory = 1 << 1,
151 Q_DECLARE_FLAGS( Flags, Flag )
171 void setTitle(
const QString & title );
185 virtual Qgis::ScriptLanguageCapabilities languageCapabilities()
const;
199 Q_DECL_DEPRECATED
void setMarginVisible(
bool margin )
SIP_DEPRECATED;
215 void setLineNumbersVisible(
bool visible );
223 bool lineNumbersVisible()
const;
229 void setFoldingVisible(
bool folding );
235 bool foldingVisible();
242 void insertText(
const QString & text );
286 static QFont getMonospaceFont();
295 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;
303 void addWarning(
int lineNumber, const QString & warning );
311 void clearWarnings();
325 bool isCursorOnLastLine()
const;
335 void setHistoryFilePath(
const QString &path );
344 QStringList history()
const;
375 void runCommand(
const QString &command,
bool skipHistory =
false );
383 virtual void moveCursorToStart();
391 virtual void moveCursorToEnd();
400 void showPreviousCommand();
409 void showNextCommand();
425 void removeHistoryCommand(
int index );
434 void clearSessionHistory();
443 void clearPersistentHistory();
450 bool writeHistoryFile();
468 virtual bool checkSyntax();
477 virtual void toggleComment();
500 static bool isFixedPitch(
const QFont &font );
502 void focusOutEvent( QFocusEvent *event )
override;
503 void keyPressEvent( QKeyEvent *event )
override;
504 void contextMenuEvent( QContextMenuEvent *event )
override;
505 bool eventFilter( QObject *watched, QEvent *event )
override;
514 virtual void initializeLexer();
528 QFont lexerFont()
const;
535 void runPostLexerConfigurationTasks();
542 void updateSoftHistory();
562 virtual void populateContextMenu( QMenu *menu );
571 virtual QString reformatCodeString(
const QString &
string );
580 virtual void showMessage(
const QString &title,
const QString &message,
Qgis::MessageLevel level );
585 void updateFolding();
586 bool readHistoryFile();
587 void syncSoftHistory();
588 void updateHistory(
const QStringList &commands,
bool skipSoftHistory =
false );
590 QString mWidgetTitle;
591 bool mMargin =
false;
592 QgsCodeEditor::Flags mFlags;
595 bool mUseDefaultSettings =
true;
597 bool mOverrideColors =
false;
598 QString mColorScheme;
599 QMap< QgsCodeEditorColorScheme::ColorRole, QColor > mCustomColors;
603 QVector< int > mWarningLines;
606 QStringList mHistory;
607 QStringList mSoftHistory;
608 int mSoftHistoryIndex = 0;
609 QString mHistoryFilePath;
613 static QMap< QgsCodeEditorColorScheme::ColorRole, QString > sColorRoleToSettingsKey;
615 static constexpr int MARKER_NUMBER = 6;
MessageLevel
Level for messages This will be used both for message log and message bar in application.
ScriptLanguage
Scripting languages.
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.
void persistentHistoryCleared()
Emitted when the persistent history of commands run in the editor is cleared.
Flag
Flags controlling behavior of code editor.
Q_DECL_DEPRECATED bool marginVisible()
Returns whether margins are in a visible state.
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) SIP_THROW(QgsSettingsException)
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_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.