A text editor based on QScintilla2.
More...
#include <qgscodeeditor.h>
|
virtual void | moveCursorToEnd () |
| Moves the cursor to the end of the document and scrolls to ensure it is visible. More...
|
|
virtual void | moveCursorToStart () |
| Moves the cursor to the start of the document and scrolls to ensure it is visible. More...
|
|
|
| QgsCodeEditor (QWidget *parent=nullptr, const QString &title=QString(), bool folding=false, bool margin=false, QgsCodeEditor::Flags flags=QgsCodeEditor::Flags()) |
| Flags controlling behavior of code editor. More...
|
|
void | addWarning (int lineNumber, const QString &warning) |
| Adds a warning message and indicator to the specified a lineNumber. More...
|
|
void | clearWarnings () |
| Clears all warning messages from the editor. More...
|
|
bool | foldingVisible () |
| Returns true if the folding controls are visible in the editor. More...
|
|
void | insertText (const QString &text) |
| Insert text at cursor position, or replace any selected text if user has made a selection. More...
|
|
bool | isCursorOnLastLine () const |
| Returns true if the cursor is on the last line of the document. More...
|
|
bool | lineNumbersVisible () const |
| Returns whether line numbers are visible in the editor. More...
|
|
Q_DECL_DEPRECATED bool | marginVisible () |
| Returns whether margins are in a visible state. More...
|
|
void | setCustomAppearance (const QString &scheme=QString(), const QMap< QgsCodeEditorColorScheme::ColorRole, QColor > &customColors=QMap< QgsCodeEditorColorScheme::ColorRole, QColor >(), const QString &fontFamily=QString(), int fontSize=0) |
| Sets a custom appearance for the widget, disconnecting it from using the standard appearance taken from QSettings. More...
|
|
void | setFoldingVisible (bool folding) |
| Set whether the folding controls are visible in the editor. More...
|
|
void | setLineNumbersVisible (bool visible) |
| Sets whether line numbers should be visible in the editor. More...
|
|
Q_DECL_DEPRECATED void | setMarginVisible (bool margin) |
| Set margin visible state. More...
|
|
void | setTitle (const QString &title) |
| Set the widget title. More...
|
|
A text editor based on QScintilla2.
- Note
- may not be available in Python bindings, depending on platform support
- Since
- QGIS 2.6
Definition at line 41 of file qgscodeeditor.h.
◆ Flag
Flags controlling behavior of code editor.
- Since
- QGIS 3.28
Enumerator |
---|
CodeFolding | Indicates that code folding should be enabled for the editor.
|
Definition at line 67 of file qgscodeeditor.h.
◆ MarginRole
Margin roles.
This enum contains the roles which the different numbered margins are used for.
- Since
- QGIS 3.16
Enumerator |
---|
LineNumbers | Line numbers.
|
ErrorIndicators | Error indicators.
|
FoldingControls | Folding controls.
|
Definition at line 54 of file qgscodeeditor.h.
◆ QgsCodeEditor()
QgsCodeEditor::QgsCodeEditor |
( |
QWidget * |
parent = nullptr , |
|
|
const QString & |
title = QString() , |
|
|
bool |
folding = false , |
|
|
bool |
margin = false , |
|
|
QgsCodeEditor::Flags |
flags = QgsCodeEditor::Flags() |
|
) |
| |
Flags controlling behavior of code editor.
- Since
- QGIS 3.28 Construct a new code editor.
- Parameters
-
parent | The parent QWidget |
title | The title to show in the code editor dialog |
folding | false: Enable folding for code editor (deprecated, use flags instead) |
margin | false: Enable margin for code editor (deprecated) |
flags | flags controlling behavior of code editor (since QGIS 3.28) |
- Since
- QGIS 2.6
Definition at line 72 of file qgscodeeditor.cpp.
◆ addWarning()
void QgsCodeEditor::addWarning |
( |
int |
lineNumber, |
|
|
const QString & |
warning |
|
) |
| |
◆ clearWarnings()
void QgsCodeEditor::clearWarnings |
( |
| ) |
|
◆ color()
Returns the color to use in the editor for the specified role.
This color will be the default theme color for the role, unless the user has manually selected a custom color scheme for the editor.
- See also
- setColor()
- Since
- QGIS 3.16
Definition at line 437 of file qgscodeeditor.cpp.
◆ defaultColor()
◆ focusOutEvent()
void QgsCodeEditor::focusOutEvent |
( |
QFocusEvent * |
event | ) |
|
|
overrideprotected |
◆ foldingVisible()
bool QgsCodeEditor::foldingVisible |
( |
| ) |
|
◆ getMonospaceFont()
QFont QgsCodeEditor::getMonospaceFont |
( |
| ) |
|
|
static |
Returns the monospaced font to use for code editors.
- Since
- QGIS 3.16
Definition at line 471 of file qgscodeeditor.cpp.
◆ initializeLexer()
void QgsCodeEditor::initializeLexer |
( |
| ) |
|
|
protectedvirtual |
◆ insertText()
void QgsCodeEditor::insertText |
( |
const QString & |
text | ) |
|
Insert text at cursor position, or replace any selected text if user has made a selection.
- Parameters
-
text | The text to be inserted |
Definition at line 352 of file qgscodeeditor.cpp.
◆ isCursorOnLastLine()
bool QgsCodeEditor::isCursorOnLastLine |
( |
| ) |
const |
Returns true
if the cursor is on the last line of the document.
- Since
- QGIS 3.28
Definition at line 542 of file qgscodeeditor.cpp.
◆ isFixedPitch()
bool QgsCodeEditor::isFixedPitch |
( |
const QFont & |
font | ) |
|
|
protected |
◆ keyPressEvent()
void QgsCodeEditor::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
overrideprotected |
◆ lexerColor()
Returns the color to use in the lexer for the specified role.
- Since
- QGIS 3.16
Definition at line 158 of file qgscodeeditor.cpp.
◆ lexerFont()
QFont QgsCodeEditor::lexerFont |
( |
| ) |
const |
|
protected |
Returns the font to use in the lexer.
- Since
- QGIS 3.16
Definition at line 174 of file qgscodeeditor.cpp.
◆ lineNumbersVisible()
bool QgsCodeEditor::lineNumbersVisible |
( |
| ) |
const |
◆ marginVisible()
Q_DECL_DEPRECATED bool QgsCodeEditor::marginVisible |
( |
| ) |
|
|
inline |
◆ moveCursorToEnd
void QgsCodeEditor::moveCursorToEnd |
( |
| ) |
|
|
virtualslot |
Moves the cursor to the end of the document and scrolls to ensure it is visible.
- Since
- QGIS 3.28
Definition at line 557 of file qgscodeeditor.cpp.
◆ moveCursorToStart
void QgsCodeEditor::moveCursorToStart |
( |
| ) |
|
|
virtualslot |
Moves the cursor to the start of the document and scrolls to ensure it is visible.
- Since
- QGIS 3.28
Definition at line 550 of file qgscodeeditor.cpp.
◆ runPostLexerConfigurationTasks()
void QgsCodeEditor::runPostLexerConfigurationTasks |
( |
| ) |
|
|
protected |
Performs tasks which must be run after a lexer has been set for the widget.
- Since
- QGIS 3.16
Definition at line 207 of file qgscodeeditor.cpp.
◆ setColor()
Sets the color to use in the editor for the specified role.
This color will be stored as the new default color for the role, to be used for all code editors.
Set color to an invalid QColor in order to clear the stored color value and reset it to the default color.
- See also
- color()
- Since
- QGIS 3.16
Definition at line 452 of file qgscodeeditor.cpp.
◆ setCustomAppearance()
Sets a custom appearance for the widget, disconnecting it from using the standard appearance taken from QSettings.
- Note
- Not available in Python bindings
- Since
- QGIS 3.16
Definition at line 503 of file qgscodeeditor.cpp.
◆ setFoldingVisible()
void QgsCodeEditor::setFoldingVisible |
( |
bool |
folding | ) |
|
◆ setLineNumbersVisible()
void QgsCodeEditor::setLineNumbersVisible |
( |
bool |
visible | ) |
|
◆ setMarginVisible()
void QgsCodeEditor::setMarginVisible |
( |
bool |
margin | ) |
|
◆ setTitle()
void QgsCodeEditor::setTitle |
( |
const QString & |
title | ) |
|
The documentation for this class was generated from the following files: