![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\reentrant More...
#include <qtexttable.h>
Public Member Functions | |
QTextTable (QTextDocument *doc) | |
~QTextTable () | |
void | resize (int rows, int cols) |
Resizes the table to contain the required number of rows and columns. | |
void | insertRows (int pos, int num) |
Inserts a number of rows before the row with the specified index. | |
void | insertColumns (int pos, int num) |
Inserts a number of columns before the column with the specified index. | |
void | appendRows (int count) |
void | appendColumns (int count) |
void | removeRows (int pos, int num) |
Removes a number of rows starting with the row at the specified index. | |
void | removeColumns (int pos, int num) |
Removes a number of columns starting with the column at the specified index. | |
void | mergeCells (int row, int col, int numRows, int numCols) |
void | mergeCells (const QTextCursor &cursor) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | splitCell (int row, int col, int numRows, int numCols) |
int | rows () const |
Returns the number of rows in the table. | |
int | columns () const |
Returns the number of columns in the table. | |
QTextTableCell | cellAt (int row, int col) const |
Returns the table cell at the given row and column in the table. | |
QTextTableCell | cellAt (int position) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the table cell that contains the character at the given position in the document. | |
QTextTableCell | cellAt (const QTextCursor &c) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the table cell containing the given cursor. | |
QTextCursor | rowStart (const QTextCursor &c) const |
Returns a cursor pointing to the start of the row that contains the given cursor. | |
QTextCursor | rowEnd (const QTextCursor &c) const |
Returns a cursor pointing to the end of the row that contains the given cursor. | |
void | setFormat (const QTextTableFormat &format) |
Sets the table's format. | |
QTextTableFormat | format () const |
Returns the table's format. | |
![]() | |
QTextFrame (QTextDocument *doc) | |
Creates a new empty frame for the text document. | |
~QTextFrame () | |
Destroys the text frame. | |
void | setFrameFormat (const QTextFrameFormat &format) |
Sets the frame's format. | |
QTextFrameFormat | frameFormat () const |
Returns the frame's format. | |
QTextCursor | firstCursorPosition () const |
Returns the first cursor position inside the frame. | |
QTextCursor | lastCursorPosition () const |
Returns the last cursor position inside the frame. | |
int | firstPosition () const |
Returns the first document position inside the frame. | |
int | lastPosition () const |
Returns the last document position inside the frame. | |
QTextFrameLayoutData * | layoutData () const |
void | setLayoutData (QTextFrameLayoutData *data) |
QList< QTextFrame * > | childFrames () const |
Returns a (possibly empty) list of the frame's child frames. | |
QTextFrame * | parentFrame () const |
Returns the frame's parent frame. | |
iterator | begin () const |
Returns an iterator pointing to the first document element inside the frame. | |
iterator | end () const |
Returns an iterator pointing to the position past the last document element inside the frame. | |
![]() | |
QTextFormat | format () const |
Returns the text object's format. | |
int | formatIndex () const |
Returns the index of the object's format in the document's internal list of formats. | |
QTextDocument * | document () const |
Returns the document this object belongs to. | |
int | objectIndex () const |
Returns the object index of this object. | |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
void | killTimer (Qt::TimerId id) |
template<typename T> | |
T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T> | |
QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T> | |
T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T> | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Friends | |
class | QTextTableCell |
Additional Inherited Members | |
![]() | |
typedef iterator | Iterator |
Qt-style synonym for QTextFrame::iterator. | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1, typename Func2> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QTextFrame (QTextFramePrivate &p, QTextDocument *doc) | |
![]() | |
QTextObject (QTextDocument *doc) | |
Creates a new QTextObject for the given document. | |
~QTextObject () | |
Destroys the text object. | |
void | setFormat (const QTextFormat &format) |
Sets the text object's format. | |
QTextObject (QTextObjectPrivate &p, QTextDocument *doc) | |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
QString | objectName |
the name of this object | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
\reentrant
The QTextTable class represents a table in a QTextDocument. \inmodule QtGui
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:
\codeline
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.
\table 80% \row
\row
\row
Definition at line 62 of file qtexttable.h.
|
explicit |
Definition at line 527 of file qtexttable.cpp.
QTextTable::~QTextTable | ( | ) |
Destroys the table.
Definition at line 536 of file qtexttable.cpp.
void QTextTable::appendColumns | ( | int | count | ) |
Definition at line 816 of file qtexttable.cpp.
void QTextTable::appendRows | ( | int | count | ) |
Definition at line 805 of file qtexttable.cpp.
QTextTableCell QTextTable::cellAt | ( | const QTextCursor & | c | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the table cell containing the given cursor.
Definition at line 592 of file qtexttable.cpp.
QTextTableCell QTextTable::cellAt | ( | int | position | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the table cell that contains the character at the given position in the document.
Definition at line 566 of file qtexttable.cpp.
QTextTableCell QTextTable::cellAt | ( | int | row, |
int | column ) const |
Returns the table cell at the given row and column in the table.
Definition at line 548 of file qtexttable.cpp.
int QTextTable::columns | ( | ) | const |
Returns the number of columns in the table.
Definition at line 1230 of file qtexttable.cpp.
|
inline |
void QTextTable::insertColumns | ( | int | index, |
int | columns ) |
Inserts a number of columns before the column with the specified index.
Definition at line 704 of file qtexttable.cpp.
void QTextTable::insertRows | ( | int | index, |
int | rows ) |
Inserts a number of rows before the row with the specified index.
Definition at line 638 of file qtexttable.cpp.
void QTextTable::mergeCells | ( | const QTextCursor & | cursor | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Merges the cells selected by the provided cursor.
Definition at line 1124 of file qtexttable.cpp.
void QTextTable::mergeCells | ( | int | row, |
int | column, | ||
int | numRows, | ||
int | numCols ) |
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.
Definition at line 964 of file qtexttable.cpp.
void QTextTable::removeColumns | ( | int | index, |
int | columns ) |
Removes a number of columns starting with the column at the specified index.
Definition at line 890 of file qtexttable.cpp.
void QTextTable::removeRows | ( | int | index, |
int | rows ) |
Removes a number of rows starting with the row at the specified index.
Definition at line 828 of file qtexttable.cpp.
void QTextTable::resize | ( | int | rows, |
int | columns ) |
Resizes the table to contain the required number of rows and columns.
Definition at line 604 of file qtexttable.cpp.
QTextCursor QTextTable::rowEnd | ( | const QTextCursor & | cursor | ) | const |
Returns a cursor pointing to the end of the row that contains the given cursor.
Definition at line 1268 of file qtexttable.cpp.
int QTextTable::rows | ( | ) | const |
Returns the number of rows in the table.
Definition at line 1216 of file qtexttable.cpp.
QTextCursor QTextTable::rowStart | ( | const QTextCursor & | cursor | ) | const |
Returns a cursor pointing to the start of the row that contains the given cursor.
Definition at line 1247 of file qtexttable.cpp.
void QTextTable::setFormat | ( | const QTextTableFormat & | format | ) |
void QTextTable::splitCell | ( | int | row, |
int | column, | ||
int | numRows, | ||
int | numCols ) |
Splits the specified cell at row and column into an array of multiple cells with dimensions specified by numRows and numCols.
Definition at line 1145 of file qtexttable.cpp.
|
friend |
Definition at line 97 of file qtexttable.h.