QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsJsonEditWidget Class Reference

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

#include <qgsjsoneditwidget.h>

Inheritance diagram for QgsJsonEditWidget:
Inheritance graph
[legend]

Public Types

enum class  FormatJson : int { Indented = 0 , Compact = 1 , Disabled = 2 }
 Format mode in the text view. More...
 
enum class  View : int { Text = 0 , Tree = 1 }
 View mode, text or tree. More...
 

Public Member Functions

 QgsJsonEditWidget (QWidget *parent=nullptr)
 Constructor for QgsJsonEditWidget.
 
QgsCodeEditorJsonjsonEditor ()
 Returns a reference to the JSON code editor used in the widget.
 
QString jsonText () const
 Returns the JSON text.
 
void setControlsVisible (bool visible)
 Set the visibility of controls to visible.
 
void setFormatJsonMode (FormatJson formatJson)
 Set the formatJson mode.
 
void setJsonText (const QString &jsonText)
 Set the JSON text in the widget to jsonText.
 
void setView (View view) const
 Set the view mode.
 

Detailed Description

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

Since
QGIS 3.20

Definition at line 31 of file qgsjsoneditwidget.h.

Member Enumeration Documentation

◆ FormatJson

enum class QgsJsonEditWidget::FormatJson : int
strong

Format mode in the text view.

Enumerator
Indented 

JSON data formatted with regular indentation.

Compact 

JSON data formatted as a compact one line string.

Disabled 

JSON data is not formatted.

Definition at line 45 of file qgsjsoneditwidget.h.

◆ View

enum class QgsJsonEditWidget::View : int
strong

View mode, text or tree.

Enumerator
Text 

JSON data displayed as text.

Tree 

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

Definition at line 38 of file qgsjsoneditwidget.h.

Constructor & Destructor Documentation

◆ QgsJsonEditWidget()

QgsJsonEditWidget::QgsJsonEditWidget ( QWidget *  parent = nullptr)
explicit

Constructor for QgsJsonEditWidget.

Parameters
parentparent widget

Definition at line 28 of file qgsjsoneditwidget.cpp.

Member Function Documentation

◆ jsonEditor()

QgsCodeEditorJson * QgsJsonEditWidget::jsonEditor ( )

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

Since
QGIS 3.36

Definition at line 62 of file qgsjsoneditwidget.cpp.

◆ jsonText()

QString QgsJsonEditWidget::jsonText ( ) const

Returns the JSON text.

Definition at line 99 of file qgsjsoneditwidget.cpp.

◆ setControlsVisible()

void QgsJsonEditWidget::setControlsVisible ( bool  visible)

Set the visibility of controls to visible.

Definition at line 130 of file qgsjsoneditwidget.cpp.

◆ setFormatJsonMode()

void QgsJsonEditWidget::setFormatJsonMode ( QgsJsonEditWidget::FormatJson  formatJson)

Set the formatJson mode.

See also
FormatJson

Definition at line 125 of file qgsjsoneditwidget.cpp.

◆ setJsonText()

void QgsJsonEditWidget::setJsonText ( const QString &  jsonText)

Set the JSON text in the widget to jsonText.

Definition at line 67 of file qgsjsoneditwidget.cpp.

◆ setView()

void QgsJsonEditWidget::setView ( QgsJsonEditWidget::View  view) const

Set the view mode.

See also
View

Definition at line 104 of file qgsjsoneditwidget.cpp.


The documentation for this class was generated from the following files: