QTextTableCell Class
La clase QTextTableCell representa las propiedades de una celda de una tabla de texto ( QTextTable). Más información...
| Encabezado: | #include <QTextTableCell> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
- Lista de todos los miembros, incluidos los miembros heredados
- QTextTableCell forma parte de las API de procesamiento de texto enriquecido.
Nota: Todas las funciones de esta clase son reentrantes.
Funciones públicas
| QTextTableCell() | |
| QTextTableCell(const QTextTableCell &other) | |
| ~QTextTableCell() | |
| QTextFrame::iterator | begin() const |
| int | column() const |
| int | columnSpan() const |
| QTextFrame::iterator | end() const |
| QTextCursor | firstCursorPosition() const |
| QTextCharFormat | format() const |
| bool | isValid() const |
| QTextCursor | lastCursorPosition() const |
| int | row() const |
| int | rowSpan() const |
| void | setFormat(const QTextCharFormat &format) |
| int | tableCellFormatIndex() const |
| bool | operator!=(const QTextTableCell &other) const |
| QTextTableCell & | operator=(const QTextTableCell &other) |
| bool | operator==(const QTextTableCell &other) const |
Descripción detallada
Las celdas de tabla son elementos de la estructura del documento que pertenecen a una tabla. La tabla ordena las celdas en filas y columnas concretas; las celdas también pueden abarcar varias columnas y filas.
Las celdas suelen crearse cuando se inserta una tabla en un documento con ` QTextCursor::insertTable()`, pero también se crean y se eliminan cuando se cambia el tamaño de una tabla.
Las celdas contienen información sobre su ubicación en una tabla; se pueden obtener los números de row() y column() de una celda, así como sus valores de rowSpan() y columnSpan().
La función format() de una celda describe el formato de caracteres predeterminado de su contenido. Las funciones firstCursorPosition() y lastCursorPosition() se utilizan para obtener la extensión de la celda en el documento.
Véase también QTextTable y QTextTableFormat.
Documentación de funciones de miembro
QTextTableCell::QTextTableCell()
Crea una celda de tabla no válida.
Véase también isValid().
QTextTableCell::QTextTableCell(const QTextTableCell &other)
Constructor de copia. Crea un nuevo objeto `QTextTableCell` a partir de la celda ` other `.
[noexcept] QTextTableCell::~QTextTableCell()
Elimina la celda de la tabla.
QTextFrame::iterator QTextTableCell::begin() const
Devuelve un iterador de marcos que apunta al principio de la celda de la tabla.
Véase también end().
int QTextTableCell::column() const
Devuelve el número de la columna de la tabla que contiene esta celda.
Véase también row().
int QTextTableCell::columnSpan() const
Devuelve el número de columnas que abarca esta celda. El valor por defecto es 1.
Véase también rowSpan().
QTextFrame::iterator QTextTableCell::end() const
Devuelve un iterador de marcos que apunta al final de la celda de la tabla.
Véase también begin().
QTextCursor QTextTableCell::firstCursorPosition() const
Devuelve la primera posición válida del cursor en esta celda.
Véase también lastCursorPosition().
QTextCharFormat QTextTableCell::format() const
Devuelve el formato de caracteres de la celda.
Véase también setFormat().
bool QTextTableCell::isValid() const
Devuelve « true » si se trata de una celda válida de la tabla; en caso contrario, devuelve «false».
QTextCursor QTextTableCell::lastCursorPosition() const
Devuelve la última posición válida del cursor en esta celda.
Véase también firstCursorPosition().
int QTextTableCell::row() const
Devuelve el número de la fila de la tabla que contiene esta celda.
Véase también column().
int QTextTableCell::rowSpan() const
Devuelve el número de filas que abarca esta celda. El valor por defecto es 1.
Véase también columnSpan().
void QTextTableCell::setFormat(const QTextCharFormat &format)
Establece el formato de caracteres de la celda en « format ». Esto se puede utilizar, por ejemplo, para cambiar el color de fondo de toda la celda:
QTextTableCell cell = table->cellAt(2, 3);
QTextCharFormat format = cell.format();
format.setBackground(Qt::blue);
cell.setFormat(format);Ten en cuenta que con esta función no se puede modificar el rango de filas o columnas de la celda. Para ello, debes utilizar las funciones QTextTable::mergeCells y QTextTable::splitCell.
Véase también format().
int QTextTableCell::tableCellFormatIndex() const
Devuelve el índice del formato de la celda de la tabla en la lista interna de formatos del documento.
Véase también QTextDocument::allFormats().
bool QTextTableCell::operator!=(const QTextTableCell &other) const
Devuelve ` true ` si este objeto de celda y el objeto de celda ` other ` hacen referencia a celdas diferentes; en caso contrario, devuelve ` false`.
QTextTableCell &QTextTableCell::operator=(const QTextTableCell &other)
Asigna la celda de la tabla « other » a esta celda de la tabla.
bool QTextTableCell::operator==(const QTextTableCell &other) const
Devuelve ` true ` si este objeto de celda y el objeto de celda ` other ` describen la misma celda; en caso contrario, devuelve ` false`.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.