Class: QgsTableEditorDialog

A reusable window for editing simple spreadsheet-style tables.

Table content is retrieved and set using the QgsTableContents class. The editor has support for table foreground and background colors, and numeric formats.

Added in version 3.12.

QgsTableEditorDialog

QgsTableEditorDialog

Class Hierarchy

Inheritance diagram of qgis.gui.QgsTableEditorDialog

Base classes

QMainWindow

QWidget

QObject

QPaintDevice

class qgis.gui.QgsTableEditorDialog[source]

Bases: QMainWindow

__init__(parent: QWidget | None = None)

Constructor for QgsTableEditorDialog with the specified parent widget.

Parameters:

parent (Optional[QWidget] = None)

signal includeHeaderChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

includeTableHeader(self) bool[source]

Returns True if the table includes a header row.

Return type:

bool

layer(self) QgsMapLayer | None[source]

Returns the (possibly None) layer associated with the expression editor context.

Added in version 3.40.

Return type:

Optional[QgsMapLayer]

registerExpressionContextGenerator(self, generator: QgsExpressionContextGenerator | None)[source]

Register an expression context generator class that will be used to retrieve an expression context for the editor when required.

Added in version 3.16.

Parameters:

generator (Optional[QgsExpressionContextGenerator])

setIncludeTableHeader(self, included: bool)[source]

Sets whether the table includes a header row.

Parameters:

included (bool)

setLayer(self, layer: QgsMapLayer | None)[source]

Sets the layer to be used associated with the expression editor context.

Added in version 3.40.

Parameters:

layer (Optional[QgsMapLayer])

setTableColumnWidth(self, column: int, width: float)[source]

Sets the configured column width for the specified column. Set width to 0 if an automatic width should be used for the column.

This should be called after a call to setTableContents().

Parameters:
  • column (int)

  • width (float)

setTableContents(self, contents: Any)[source]

Sets the contents to show in the editor widget.

See also

tableContents()

Parameters:

contents (Any)

setTableContentsFromClipboard(self) bool[source]

Parses the clipboard text into contents to show in the editor widget.

Return type:

bool

Returns:

True if the clipboard was successfully parsed

See also

tableContents()

setTableHeaders(self, headers: Iterable[Any])[source]

Sets the table headers.

See also

tableHeaders()

Parameters:

headers (Iterable[Any])

setTableRowHeight(self, row: int, height: float)[source]

Sets the configured row height for the specified row. Set height to 0 if an automatic height should be used for the row.

This should be called after a call to setTableContents().

See also

tableRowHeight()

Parameters:
  • row (int)

  • height (float)

signal tableChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

tableColumnWidth(self, column: int) float[source]

Returns the configured column width for the specified column, or 0 if an automatic width should be used for the column.

Parameters:

column (int)

Return type:

float

tableContents(self) Any[source]

Returns the current contents of the editor widget table.

Return type:

Any

tableHeaders(self) List[Any][source]

Returns the table header values.

Return type:

List[Any]

tableRowHeight(self, row: int) float[source]

Returns the configured row height for the specified row, or 0 if an automatic height should be used for the row.

Parameters:

row (int)

Return type:

float