Class: QgsCodeEditor

class qgis.gui.QgsCodeEditor(parent: QWidget = None, title: str = '', folding: bool = False, margin: bool = False)

Bases: PyQt5.Qsci.QsciScintilla

Construct a new code editor.

Parameters
  • parent (QWidget = None) – The parent QWidget

  • title (str = '') – The title to show in the code editor dialog

  • folding (bool = False) – False: Enable folding for code editor

  • margin (bool = False) – False: Enable margin for code editor

New in version 2.6.

A text editor based on QScintilla2.

Note

may not be available in Python bindings, depending on platform support

actionEvent(self, QActionEvent)
canInsertFromMimeData(self, QMimeData) → bool
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
drawFrame(self, QPainter)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, event: QFocusEvent)
Parameters

event (QFocusEvent) –

focusPreviousChild(self) → bool
foldingVisible(self) → bool
Return type

bool

fromMimeData(self, QMimeData) → Tuple[QByteArray, bool]
getMonospaceFont(self) → QFont
Return type

QFont

hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionFrame)
inputMethodEvent(self, QInputMethodEvent)
inputMethodQuery(self, Qt.InputMethodQuery) → Any
insertText(self, text: str)

Insert text at cursor position, or replace any selected text if user has made a selection.

Parameters

text (str) – The text to be inserted

isFixedPitch(self, font: QFont) → bool
Parameters

font (QFont) –

Return type

bool

isSignalConnected(self, QMetaMethod) → bool
keyPressEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
marginVisible(self) → bool
Return type

bool

metric(self, QPaintDevice.PaintDeviceMetric) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
QgsCodeEditor.scrollContentsBy(self, int, int)
sender(self) → QObject
senderSignalIndex(self) → int
setFoldingVisible(self, folding: bool)

Set folding visible state

Parameters

folding (bool) – Set folding in the editor

setMarginVisible(self, margin: bool)

Set margin visible state

Parameters

margin (bool) – Set margin in the editor

setTitle(self, title: str)

Set the widget title

Parameters

title (str) – widget title

QgsCodeEditor.setViewportMargins(self, int, int, int, int)

setViewportMargins(self, QMargins)

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
toMimeData(self, Union[QByteArray, bytes, bytearray], bool) → QMimeData
updateMicroFocus(self)
viewportEvent(self, QEvent) → bool
viewportMargins(self) → QMargins
viewportSizeHint(self) → QSize
wheelEvent(self, QWheelEvent)