Class: QgsJsonEditWidget¶
A widget for displaying JSON data in a code highlighted text or tree form.
Added in version 3.20.
Class Hierarchy¶
Base classes¶
Enums
Format mode in the text view |
|
View mode, text or tree. |
Methods
Returns a reference to the JSON code editor used in the widget. |
|
Returns the JSON text. |
|
Set the visibility of controls to visible. |
|
Set the formatJson mode. |
|
Set the JSON text in the widget to jsonText. |
|
Set the view mode. |
- class qgis.gui.QgsJsonEditWidget[source]¶
Bases:
QWidget
- __init__(parent: QWidget | None = None)
Constructor for QgsJsonEditWidget.
- Parameters:
parent (Optional[QWidget] = None) – parent widget
- class FormatJson(*values)¶
Bases:
IntEnum
Format mode in the text view
Indented
: JSON data formatted with regular indentationCompact
: JSON data formatted as a compact one line stringDisabled
: JSON data is not formatted
- Compact = 1¶
- Disabled = 2¶
- Indented = 0¶
- class View(*values)¶
Bases:
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¶
- jsonEditor(self) QgsCodeEditorJson | None [source]¶
Returns a reference to the JSON code editor used in the widget.
Added in version 3.36.
- Return type:
Optional[QgsCodeEditorJson]
- setControlsVisible(self, visible: bool)[source]¶
Set the visibility of controls to
visible
.- Parameters:
visible (bool)
- setFormatJsonMode(self, formatJson: QgsJsonEditWidget.FormatJson)[source]¶
Set the
formatJson
mode.See also
FormatJson
- Parameters:
formatJson (QgsJsonEditWidget.FormatJson)
- setJsonText(self, jsonText: str | None)[source]¶
Set the JSON text in the widget to
jsonText
.- Parameters:
jsonText (Optional[str])
- setView(self, view: QgsJsonEditWidget.View)[source]¶
Set the
view
mode.See also
View
- Parameters:
view (QgsJsonEditWidget.View)