本文整理汇总了C++中QTextFormat::toListFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextFormat::toListFormat方法的具体用法?C++ QTextFormat::toListFormat怎么用?C++ QTextFormat::toListFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextFormat
的用法示例。
在下文中一共展示了QTextFormat::toListFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeFormats
void QTextOdfWriter::writeFormats(QXmlStreamWriter &writer, QSet<int> formats) const
{
writer.writeStartElement(officeNS, QString::fromLatin1("automatic-styles"));
QVector<QTextFormat> allStyles = m_document->allFormats();
QSetIterator<int> formatId(formats);
while(formatId.hasNext()) {
int formatIndex = formatId.next();
QTextFormat textFormat = allStyles.at(formatIndex);
switch (textFormat.type()) {
case QTextFormat::CharFormat:
if (textFormat.isTableCellFormat())
writeTableCellFormat(writer, textFormat.toTableCellFormat(), formatIndex);
else
writeCharacterFormat(writer, textFormat.toCharFormat(), formatIndex);
break;
case QTextFormat::BlockFormat:
writeBlockFormat(writer, textFormat.toBlockFormat(), formatIndex);
break;
case QTextFormat::ListFormat:
writeListFormat(writer, textFormat.toListFormat(), formatIndex);
break;
case QTextFormat::FrameFormat:
writeFrameFormat(writer, textFormat.toFrameFormat(), formatIndex);
break;
case QTextFormat::TableFormat:
;break;
}
}
writer.writeEndElement(); // automatic-styles
}
示例2: toFormat
void tst_QTextFormat::toFormat()
{
{
QTextFormat fmt = QTextFrameFormat();
QCOMPARE(fmt.toFrameFormat().type(), int(QTextFormat::FrameFormat));
}
{
QTextFormat fmt = QTextTableFormat();
QCOMPARE(fmt.toTableFormat().type(), int(QTextFormat::FrameFormat));
QCOMPARE(fmt.toTableFormat().objectType(), int(QTextFormat::TableObject));
}
{
QTextFormat fmt = QTextBlockFormat();
QCOMPARE(fmt.toBlockFormat().type(), int(QTextFormat::BlockFormat));
}
{
QTextFormat fmt = QTextCharFormat();
QCOMPARE(fmt.toCharFormat().type(), int(QTextFormat::CharFormat));
}
{
QTextFormat fmt = QTextListFormat();
QCOMPARE(fmt.toListFormat().type(), int(QTextFormat::ListFormat));
}
}