QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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. More...
 
QString jsonText () const
 Returns the JSON text. More...
 
void setControlsVisible (bool visible)
 Set the visibility of controls to visible. More...
 
void setFormatJsonMode (FormatJson formatJson)
 Set the formatJson mode. More...
 
void setJsonText (const QString &jsonText)
 Set the JSON text in the widget to jsonText. More...
 
void setView (View view) const
 Set the view mode. More...
 

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 27 of file qgsjsoneditwidget.cpp.

Member Function Documentation

◆ jsonText()

QString QgsJsonEditWidget::jsonText ( ) const

Returns the JSON text.

Definition at line 95 of file qgsjsoneditwidget.cpp.

◆ setControlsVisible()

void QgsJsonEditWidget::setControlsVisible ( bool  visible)

Set the visibility of controls to visible.

Definition at line 126 of file qgsjsoneditwidget.cpp.

◆ setFormatJsonMode()

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

Set the formatJson mode.

See also
FormatJson

Definition at line 121 of file qgsjsoneditwidget.cpp.

◆ setJsonText()

void QgsJsonEditWidget::setJsonText ( const QString &  jsonText)

Set the JSON text in the widget to jsonText.

Definition at line 63 of file qgsjsoneditwidget.cpp.

◆ setView()

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

Set the view mode.

See also
View

Definition at line 100 of file qgsjsoneditwidget.cpp.


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