Skip to content

PythonQt.Qt.QTextTable

QTextTable

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block, and is surrounded by a frame.

Tables are usually created and inserted into a document with the QTextCursor::insertTable() function. For example, we can insert a table with three rows and two columns at the current cursor position in an editor using the following lines of code:

    QTextCursor cursor(editor->textCursor());
    cursor.movePosition(QTextCursor::Start);

    QTextTable *table = cursor.insertTable(rows, columns, tableFormat);

The table format is either defined when the table is created or changed later with setFormat().

The table currently being edited by the cursor is found with QTextCursor::currentTable(). This allows its format or dimensions to be changed after it has been inserted into a document.

A table's size can be changed with resize(), or by using insertRows(), insertColumns(), removeRows(), or removeColumns(). Use cellAt() to retrieve table cells.

The starting and ending positions of table rows can be found by moving a cursor within a table, and using the rowStart() and rowEnd() functions to obtain cursors at the start and end of each row.

Rows and columns within a QTextTable can be merged and split using the mergeCells() and splitCell() functions. However, only cells that span multiple rows or columns can be split. (Merging or splitting does not increase or decrease the number of rows and columns.)

Note that if you have merged multiple columns and rows into one cell, you will not be able to split the merged cell into new cells spanning over more than one row or column. To be able to split cells spanning over several rows and columns you need to do this over several iterations.

Original Table Suppose we have a 2x3 table of names and addresses. To merge both columns in the first row we invoke mergeCells() with row \= 0, column \= 0, numRows \= 1 and numColumns \= 2. table->mergeCells(0, 0, 1, 2);
This gives us the following table. To split the first row of the table back into two cells, we invoke the splitCell() function with numRows and numCols \= 1. table->splitCell(0, 0, 1, 1);
Split Table This results in the original table.

Source: https://doc.qt.io/archives/qt-5.15/qtexttable.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
appendColumns function (self, count: int) -> None Appends count columns at the right side of the table. (shared captured text)
appendRows function (self, count: int) -> None Appends count rows at the bottom of the table. (shared captured text)
begin function (self) -> Any (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
cellAt function (self, row: Any, col: Any) -> Any X.cellAt(row, col) -> PythonQt.QtGui.QTextTableCell (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
childFrames function (self) -> tuple X.childFrames() -> tuple (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
columns function (self) -> int X.columns() -> int (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QTextTable.destroyed; argument details are not documented.
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
document function (self) -> Any X.document() -> PythonQt.QtGui.QTextDocument (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
end function (self) -> Any (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
firstCursorPosition function (self) -> Any X.firstCursorPosition() -> PythonQt.QtGui.QTextCursor (shared captured text)
firstPosition function (self) -> int X.firstPosition() -> int (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtGui.QTextTableFormat (shared captured text)
formatIndex function (self) -> int X.formatIndex() -> int (shared captured text)
frameFormat function (self) -> Any X.frameFormat() -> PythonQt.QtGui.QTextFrameFormat (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
insertColumns function (self, pos: int, num: int) -> None X.insertColumns(pos, num) (shared captured text)
insertRows function (self, pos: int, num: int) -> None X.insertRows(pos, num) (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
lastCursorPosition function (self) -> Any X.lastCursorPosition() -> PythonQt.QtGui.QTextCursor (shared captured text)
lastPosition function (self) -> int X.lastPosition() -> int (shared captured text)
mergeCells function (self, row: Any, col: Any, numRows: Any, numCols: Any) -> None X.mergeCells(row, col, numRows, numCols) (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
objectIndex function (self) -> int X.objectIndex() -> int (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QTextTable.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
parentFrame function (self) -> Any X.parentFrame() -> PythonQt.QtGui.QTextFrame (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeColumns function (self, pos: int, num: int) -> None X.removeColumns(pos, num) (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
removeRows function (self, pos: int, num: int) -> None X.removeRows(pos, num) (shared captured text)
resize function (self, rows: int, cols: int) -> None X.resize(rows, cols) (shared captured text)
rowEnd function (self, c: Any) -> Any X.rowEnd(c) -> PythonQt.QtGui.QTextCursor (shared captured text)
rowStart function (self, c: Any) -> Any X.rowStart(c) -> PythonQt.QtGui.QTextCursor (shared captured text)
rows function (self) -> int X.rows() -> int (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setFormat function (self, format: Any) -> None Sets the table's format. (shared captured text)
setFrameFormat function (self, format: Any) -> Any (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
splitCell function (self, row: int, col: int, numRows: int, numCols: int) -> None X.splitCell(row, col, numRows, numCols) (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)