Class: QgsJsonEditWidget

class qgis.gui.QgsJsonEditWidget

Bases: PyQt5.QtWidgets.QWidget

The QgsJsonEditWidget is a widget to display JSON data in a code highlighted text or tree form.

New in version 3.20.

QgsJsonEditWidget(parent: QWidget = None) Constructor for QgsJsonEditWidget.

Parameters:

parent

parent widget

Enums

FormatJson

Bases: enum.IntEnum

View

Bases: enum.IntEnum

Methods

actionEvent

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

inputMethodEvent

isSignalConnected

jsonEditor

Returns a reference to the JSON code editor used in the widget.

jsonText

Returns the JSON text.

keyPressEvent

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setControlsVisible

Set the visibility of controls to visible.

setFormatJsonMode

Set the formatJson mode.

setJsonText

Set the JSON text in the widget to jsonText.

setView

Set the view mode.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

class FormatJson(value)

Bases: enum.IntEnum

Format mode in the text view

  • Indented: JSON data formatted with regular indentation

  • Compact: JSON data formatted as a compact one line string

  • Disabled: JSON data is not formatted

Compact = 1
Disabled = 2
Indented = 0
class View(value)

Bases: enum.IntEnum

View mode, text or tree.

  • Text: JSON data displayed as text.

  • Tree: JSON data displayed as tree. Tree view is disabled for invalid JSON data.

Text = 0
Tree = 1
actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.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)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
jsonEditor(self) QgsCodeEditorJson

Returns a reference to the JSON code editor used in the widget.

New in version 3.36.

Return type:

QgsCodeEditorJson

jsonText(self) str

Returns the JSON text.

Return type:

str

keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
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], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setControlsVisible(self, visible: bool)

Set the visibility of controls to visible.

Parameters:

visible (bool) –

setFormatJsonMode(self, formatJson: QgsJsonEditWidget.FormatJson)

Set the formatJson mode.

See also

FormatJson

Parameters:

formatJson (QgsJsonEditWidget.FormatJson) –

setJsonText(self, jsonText: str)

Set the JSON text in the widget to jsonText.

Parameters:

jsonText (str) –

setView(self, view: QgsJsonEditWidget.View)

Set the view mode.

See also

View

Parameters:

view (QgsJsonEditWidget.View) –

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)