[][src]Struct qt_gui::QTextTable

#[repr(C)]pub struct QTextTable { /* fields omitted */ }

The QTextTable class represents a table in a QTextDocument.

C++ class: QTextTable.

C++ documentation:

The QTextTable class represents a table in a QTextDocument.

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 TableSuppose 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 TableThis results in the original table.

Methods

impl QTextTable[src]

pub unsafe fn append_columns(&self, count: c_int)[src]

Appends count columns at the right side of the table.

Calls C++ function: void QTextTable::appendColumns(int count).

C++ documentation:

Appends count columns at the right side of the table.

This function was introduced in Qt 4.5.

See also insertColumns(), insertRows(), resize(), removeRows(), removeColumns(), and appendRows().

pub unsafe fn append_rows(&self, count: c_int)[src]

Appends count rows at the bottom of the table.

Calls C++ function: void QTextTable::appendRows(int count).

C++ documentation:

Appends count rows at the bottom of the table.

This function was introduced in Qt 4.5.

See also insertColumns(), insertRows(), resize(), removeRows(), removeColumns(), and appendColumns().

pub unsafe fn cell_at_2_int(
    &self,
    row: c_int,
    col: c_int
) -> CppBox<QTextTableCell>
[src]

Returns the table cell at the given row and column in the table.

Calls C++ function: QTextTableCell QTextTable::cellAt(int row, int col) const.

C++ documentation:

Returns the table cell at the given row and column in the table.

See also columns() and rows().

pub unsafe fn cell_at_int(&self, position: c_int) -> CppBox<QTextTableCell>[src]

This is an overloaded function.

Calls C++ function: QTextTableCell QTextTable::cellAt(int position) const.

C++ documentation:

This is an overloaded function.

Returns the table cell that contains the character at the given position in the document.

pub unsafe fn cell_at_q_text_cursor(
    &self,
    c: impl CastInto<Ref<QTextCursor>>
) -> CppBox<QTextTableCell>
[src]

This is an overloaded function.

Calls C++ function: QTextTableCell QTextTable::cellAt(const QTextCursor& c) const.

C++ documentation:

This is an overloaded function.

Returns the table cell containing the given cursor.

pub unsafe fn columns(&self) -> c_int[src]

Returns the number of columns in the table.

Calls C++ function: int QTextTable::columns() const.

C++ documentation:

Returns the number of columns in the table.

See also rows().

pub unsafe fn format(&self) -> CppBox<QTextTableFormat>[src]

Returns the table's format.

Calls C++ function: QTextTableFormat QTextTable::format() const.

C++ documentation:

Returns the table's format.

See also setFormat().

pub unsafe fn insert_columns(&self, pos: c_int, num: c_int)[src]

Inserts a number of columns before the column with the specified index.

Calls C++ function: void QTextTable::insertColumns(int pos, int num).

C++ documentation:

Inserts a number of columns before the column with the specified index.

See also insertRows(), resize(), removeRows(), removeColumns(), appendRows(), and appendColumns().

pub unsafe fn insert_rows(&self, pos: c_int, num: c_int)[src]

Inserts a number of rows before the row with the specified index.

Calls C++ function: void QTextTable::insertRows(int pos, int num).

C++ documentation:

Inserts a number of rows before the row with the specified index.

See also resize(), insertColumns(), removeRows(), removeColumns(), appendRows(), and appendColumns().

pub unsafe fn merge_cells_4a(
    &self,
    row: c_int,
    col: c_int,
    num_rows: c_int,
    num_cols: c_int
)
[src]

Merges the cell at the specified row and column with the adjacent cells into one cell. The new cell will span numRows rows and numCols columns. This method does nothing if numRows or numCols is less than the current number of rows or columns spanned by the cell.

Calls C++ function: void QTextTable::mergeCells(int row, int col, int numRows, int numCols).

C++ documentation:

Merges the cell at the specified row and column with the adjacent cells into one cell. The new cell will span numRows rows and numCols columns. This method does nothing if numRows or numCols is less than the current number of rows or columns spanned by the cell.

This function was introduced in Qt 4.1.

See also splitCell().

pub unsafe fn merge_cells_1a(&self, cursor: impl CastInto<Ref<QTextCursor>>)[src]

This is an overloaded function.

Calls C++ function: void QTextTable::mergeCells(const QTextCursor& cursor).

C++ documentation:

This is an overloaded function.

Merges the cells selected by the provided cursor.

This function was introduced in Qt 4.1.

See also splitCell().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QTextTable::metaObject() const.

pub unsafe fn new(doc: impl CastInto<Ptr<QTextDocument>>) -> QBox<QTextTable>[src]

Calls C++ function: [constructor] void QTextTable::QTextTable(QTextDocument* doc).

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QTextTable::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QTextTable::qt_metacast(const char* arg1).

pub unsafe fn remove_columns(&self, pos: c_int, num: c_int)[src]

Removes a number of columns starting with the column at the specified index.

Calls C++ function: void QTextTable::removeColumns(int pos, int num).

C++ documentation:

Removes a number of columns starting with the column at the specified index.

See also insertRows(), insertColumns(), removeRows(), resize(), appendRows(), and appendColumns().

pub unsafe fn remove_rows(&self, pos: c_int, num: c_int)[src]

Removes a number of rows starting with the row at the specified index.

Calls C++ function: void QTextTable::removeRows(int pos, int num).

C++ documentation:

Removes a number of rows starting with the row at the specified index.

See also insertRows(), insertColumns(), resize(), removeColumns(), appendRows(), and appendColumns().

pub unsafe fn resize(&self, rows: c_int, cols: c_int)[src]

Resizes the table to contain the required number of rows and columns.

Calls C++ function: void QTextTable::resize(int rows, int cols).

C++ documentation:

Resizes the table to contain the required number of rows and columns.

See also insertRows(), insertColumns(), removeRows(), and removeColumns().

pub unsafe fn row_end(
    &self,
    c: impl CastInto<Ref<QTextCursor>>
) -> CppBox<QTextCursor>
[src]

Returns a cursor pointing to the end of the row that contains the given cursor.

Calls C++ function: QTextCursor QTextTable::rowEnd(const QTextCursor& c) const.

C++ documentation:

Returns a cursor pointing to the end of the row that contains the given cursor.

See also rowStart().

pub unsafe fn row_start(
    &self,
    c: impl CastInto<Ref<QTextCursor>>
) -> CppBox<QTextCursor>
[src]

Returns a cursor pointing to the start of the row that contains the given cursor.

Calls C++ function: QTextCursor QTextTable::rowStart(const QTextCursor& c) const.

C++ documentation:

Returns a cursor pointing to the start of the row that contains the given cursor.

See also rowEnd().

pub unsafe fn rows(&self) -> c_int[src]

Returns the number of rows in the table.

Calls C++ function: int QTextTable::rows() const.

C++ documentation:

Returns the number of rows in the table.

See also columns().

pub unsafe fn set_format(&self, format: impl CastInto<Ref<QTextTableFormat>>)[src]

Sets the table's format.

Calls C++ function: void QTextTable::setFormat(const QTextTableFormat& format).

C++ documentation:

Sets the table's format.

See also format().

pub unsafe fn split_cell(
    &self,
    row: c_int,
    col: c_int,
    num_rows: c_int,
    num_cols: c_int
)
[src]

Splits the specified cell at row and column into an array of multiple cells with dimensions specified by numRows and numCols.

Calls C++ function: void QTextTable::splitCell(int row, int col, int numRows, int numCols).

C++ documentation:

Splits the specified cell at row and column into an array of multiple cells with dimensions specified by numRows and numCols.

Note: It is only possible to split cells that span multiple rows or columns, such as rows that have been merged using mergeCells().

This function was introduced in Qt 4.1.

See also mergeCells().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QTextTable::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QTextTable::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QTextFrame>

pub unsafe fn begin(&self) -> CppBox<Iterator>[src]

Returns an iterator pointing to the first document element inside the frame. Please see the document STL-style-Iterators for more information.

Calls C++ function: QTextFrame::iterator QTextFrame::begin() const.

C++ documentation:

Returns an iterator pointing to the first document element inside the frame. Please see the document STL-style-Iterators for more information.

See also end().

pub unsafe fn child_frames(&self) -> CppBox<QListOfQTextFrame>[src]

Returns a (possibly empty) list of the frame's child frames.

Calls C++ function: QList<QTextFrame*> QTextFrame::childFrames() const.

C++ documentation:

Returns a (possibly empty) list of the frame's child frames.

See also parentFrame().

pub unsafe fn end(&self) -> CppBox<Iterator>[src]

Returns an iterator pointing to the position past the last document element inside the frame. Please see the document STL-Style Iterators for more information.

Calls C++ function: QTextFrame::iterator QTextFrame::end() const.

C++ documentation:

Returns an iterator pointing to the position past the last document element inside the frame. Please see the document STL-Style Iterators for more information.

See also begin().

pub unsafe fn first_cursor_position(&self) -> CppBox<QTextCursor>[src]

Returns the first cursor position inside the frame.

Calls C++ function: QTextCursor QTextFrame::firstCursorPosition() const.

C++ documentation:

Returns the first cursor position inside the frame.

See also lastCursorPosition(), firstPosition(), and lastPosition().

pub unsafe fn first_position(&self) -> c_int[src]

Returns the first document position inside the frame.

Calls C++ function: int QTextFrame::firstPosition() const.

C++ documentation:

Returns the first document position inside the frame.

See also lastPosition(), firstCursorPosition(), and lastCursorPosition().

pub unsafe fn frame_format(&self) -> CppBox<QTextFrameFormat>[src]

Returns the frame's format.

Calls C++ function: QTextFrameFormat QTextFrame::frameFormat() const.

C++ documentation:

Returns the frame's format.

See also setFrameFormat().

pub unsafe fn last_cursor_position(&self) -> CppBox<QTextCursor>[src]

Returns the last cursor position inside the frame.

Calls C++ function: QTextCursor QTextFrame::lastCursorPosition() const.

C++ documentation:

Returns the last cursor position inside the frame.

See also firstCursorPosition(), firstPosition(), and lastPosition().

pub unsafe fn last_position(&self) -> c_int[src]

Returns the last document position inside the frame.

Calls C++ function: int QTextFrame::lastPosition() const.

C++ documentation:

Returns the last document position inside the frame.

See also firstPosition(), firstCursorPosition(), and lastCursorPosition().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QTextFrame::metaObject() const.

pub unsafe fn parent_frame(&self) -> QPtr<QTextFrame>[src]

Returns the frame's parent frame. If the frame is the root frame of a document, this will return 0.

Calls C++ function: QTextFrame* QTextFrame::parentFrame() const.

C++ documentation:

Returns the frame's parent frame. If the frame is the root frame of a document, this will return 0.

See also childFrames() and QTextDocument::rootFrame().

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QTextFrame::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QTextFrame::qt_metacast(const char* arg1).

pub unsafe fn set_frame_format(
    &self,
    format: impl CastInto<Ref<QTextFrameFormat>>
)
[src]

Sets the frame's format.

Calls C++ function: void QTextFrame::setFrameFormat(const QTextFrameFormat& format).

C++ documentation:

Sets the frame's format.

See also frameFormat().

Trait Implementations

impl CppDeletable for QTextTable[src]

unsafe fn delete(&self)[src]

Calls C++ function: virtual [destructor] void QTextTable::~QTextTable().

impl Deref for QTextTable[src]

type Target = QTextFrame

The resulting type after dereferencing.

fn deref(&self) -> &QTextFrame[src]

Calls C++ function: QTextFrame* static_cast<QTextFrame*>(QTextTable* ptr).

impl DynamicCast<QTextTable> for QTextFrame[src]

unsafe fn dynamic_cast(ptr: Ptr<QTextFrame>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* dynamic_cast<QTextTable*>(QTextFrame* ptr).

impl DynamicCast<QTextTable> for QTextObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QTextObject>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* dynamic_cast<QTextTable*>(QTextObject* ptr).

impl DynamicCast<QTextTable> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* dynamic_cast<QTextTable*>(QObject* ptr).

impl StaticDowncast<QTextTable> for QTextFrame[src]

unsafe fn static_downcast(ptr: Ptr<QTextFrame>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* static_cast<QTextTable*>(QTextFrame* ptr).

impl StaticDowncast<QTextTable> for QTextObject[src]

unsafe fn static_downcast(ptr: Ptr<QTextObject>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* static_cast<QTextTable*>(QTextObject* ptr).

impl StaticDowncast<QTextTable> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QTextTable>[src]

Calls C++ function: QTextTable* static_cast<QTextTable*>(QObject* ptr).

impl StaticUpcast<QObject> for QTextTable[src]

unsafe fn static_upcast(ptr: Ptr<QTextTable>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QTextTable* ptr).

impl StaticUpcast<QTextFrame> for QTextTable[src]

unsafe fn static_upcast(ptr: Ptr<QTextTable>) -> Ptr<QTextFrame>[src]

Calls C++ function: QTextFrame* static_cast<QTextFrame*>(QTextTable* ptr).

impl StaticUpcast<QTextObject> for QTextTable[src]

unsafe fn static_upcast(ptr: Ptr<QTextTable>) -> Ptr<QTextObject>[src]

Calls C++ function: QTextObject* static_cast<QTextObject*>(QTextTable* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.