本文整理汇总了C++中QTextTableCell::tableCellFormatIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextTableCell::tableCellFormatIndex方法的具体用法?C++ QTextTableCell::tableCellFormatIndex怎么用?C++ QTextTableCell::tableCellFormatIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextTableCell
的用法示例。
在下文中一共展示了QTextTableCell::tableCellFormatIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeFrame
void QTextOdfWriter::writeFrame(QXmlStreamWriter &writer, const QTextFrame *frame)
{
Q_ASSERT(frame);
const QTextTable *table = qobject_cast<const QTextTable*> (frame);
if (table) { // Start a table.
writer.writeStartElement(tableNS, QString::fromLatin1("table"));
writer.writeEmptyElement(tableNS, QString::fromLatin1("table-column"));
writer.writeAttribute(tableNS, QString::fromLatin1("number-columns-repeated"), QString::number(table->columns()));
} else if (frame->document() && frame->document()->rootFrame() != frame) { // start a section
writer.writeStartElement(textNS, QString::fromLatin1("section"));
}
QTextFrame::iterator iterator = frame->begin();
QTextFrame *child = 0;
int tableRow = -1;
while (! iterator.atEnd()) {
if (iterator.currentFrame() && child != iterator.currentFrame())
writeFrame(writer, iterator.currentFrame());
else { // no frame, its a block
QTextBlock block = iterator.currentBlock();
if (table) {
QTextTableCell cell = table->cellAt(block.position());
if (tableRow < cell.row()) {
if (tableRow >= 0)
writer.writeEndElement(); // close table row
tableRow = cell.row();
writer.writeStartElement(tableNS, QString::fromLatin1("table-row"));
}
writer.writeStartElement(tableNS, QString::fromLatin1("table-cell"));
if (cell.columnSpan() > 1)
writer.writeAttribute(tableNS, QString::fromLatin1("number-columns-spanned"), QString::number(cell.columnSpan()));
if (cell.rowSpan() > 1)
writer.writeAttribute(tableNS, QString::fromLatin1("number-rows-spanned"), QString::number(cell.rowSpan()));
if (cell.format().isTableCellFormat()) {
writer.writeAttribute(tableNS, QString::fromLatin1("style-name"), QString::fromLatin1("T%1").arg(cell.tableCellFormatIndex()));
}
}
writeBlock(writer, block);
if (table)
writer.writeEndElement(); // table-cell
}
child = iterator.currentFrame();
++iterator;
}
if (tableRow >= 0)
writer.writeEndElement(); // close table-row
if (table || (frame->document() && frame->document()->rootFrame() != frame))
writer.writeEndElement(); // close table or section element
}