17#ifndef QGSCODEEDITOR_H
18#define QGSCODEEDITOR_H
25#include <Qsci/qsciapis.h>
50 int exec(
const QString &command );
133 CodeFolding = 1 << 0,
142 Q_DECLARE_FLAGS( Flags, Flag )
162 void setTitle(
const QString & title );
183 Q_DECL_DEPRECATED
void setMarginVisible(
bool margin )
SIP_DEPRECATED;
199 void setLineNumbersVisible(
bool visible );
207 bool lineNumbersVisible()
const;
213 void setFoldingVisible(
bool folding );
219 bool foldingVisible();
226 void insertText(
const QString & text );
270 static QFont getMonospaceFont();
279 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;
287 void addWarning(
int lineNumber, const QString & warning );
295 void clearWarnings();
309 bool isCursorOnLastLine()
const;
319 void setHistoryFilePath(
const QString &path );
328 QStringList history()
const;
356 void runCommand(
const QString &command );
364 virtual void moveCursorToStart();
372 virtual void moveCursorToEnd();
381 void showPreviousCommand();
390 void showNextCommand();
406 void removeHistoryCommand(
int index );
415 void clearSessionHistory();
424 void clearPersistentHistory();
431 bool writeHistoryFile();
454 static bool isFixedPitch(
const QFont &font );
456 void focusOutEvent( QFocusEvent *event )
override;
457 void keyPressEvent( QKeyEvent *event )
override;
458 void contextMenuEvent( QContextMenuEvent *event )
override;
467 virtual void initializeLexer();
481 QFont lexerFont()
const;
488 void runPostLexerConfigurationTasks();
495 void updateSoftHistory();
515 virtual void populateContextMenu( QMenu *menu );
520 void updateFolding();
521 bool readHistoryFile();
522 void syncSoftHistory();
523 void updateHistory(
const QStringList &commands,
bool skipSoftHistory =
false );
525 QString mWidgetTitle;
526 bool mMargin =
false;
527 QgsCodeEditor::Flags mFlags;
530 bool mUseDefaultSettings =
true;
532 bool mOverrideColors =
false;
533 QString mColorScheme;
534 QMap< QgsCodeEditorColorScheme::ColorRole, QColor > mCustomColors;
538 QVector< int > mWarningLines;
541 QStringList mHistory;
542 QStringList mSoftHistory;
543 int mSoftHistoryIndex = 0;
544 QString mHistoryFilePath;
548 static QMap< QgsCodeEditorColorScheme::ColorRole, QString > sColorRoleToSettingsKey;
550 static constexpr int MARKER_NUMBER = 6;
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()
#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.