本文整理汇总了C++中QTextCursor::blockCharFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextCursor::blockCharFormat方法的具体用法?C++ QTextCursor::blockCharFormat怎么用?C++ QTextCursor::blockCharFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextCursor
的用法示例。
在下文中一共展示了QTextCursor::blockCharFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillListButtons
void SimpleParagraphWidget::fillListButtons()
{
KoZoomHandler zoomHandler;
zoomHandler.setZoom(1.2);
zoomHandler.setDpi(72, 72);
KoInlineTextObjectManager itom;
KoTextRangeManager tlm;
TextShape textShape(&itom, &tlm);
textShape.setSize(QSizeF(300, 100));
QTextCursor cursor (textShape.textShapeData()->document());
foreach(const Lists::ListStyleItem &item, Lists::genericListStyleItems()) {
QPixmap pm(48,48);
pm.fill(Qt::transparent);
QPainter p(&pm);
p.translate(0, -1.5);
p.setRenderHint(QPainter::Antialiasing);
if(item.style != KoListStyle::None) {
KoListStyle listStyle;
KoListLevelProperties llp = listStyle.levelProperties(1);
llp.setStyle(item.style);
if (KoListStyle::isNumberingStyle(item.style)) {
llp.setStartValue(1);
llp.setListItemSuffix(".");
}
listStyle.setLevelProperties(llp);
cursor.select(QTextCursor::Document);
QTextCharFormat textCharFormat=cursor.blockCharFormat();
textCharFormat.setFontPointSize(11);
textCharFormat.setFontWeight(QFont::Normal);
cursor.setCharFormat(textCharFormat);
QTextBlock cursorBlock = cursor.block();
KoTextBlockData data(cursorBlock);
cursor.insertText("----");
listStyle.applyStyle(cursor.block(),1);
cursorBlock = cursor.block();
KoTextBlockData data1(cursorBlock);
cursor.insertText("\n----");
cursorBlock = cursor.block();
KoTextBlockData data2(cursorBlock);
cursor.insertText("\n----");
cursorBlock = cursor.block();
KoTextBlockData data3(cursorBlock);
KoTextDocumentLayout *lay = dynamic_cast<KoTextDocumentLayout*>(textShape.textShapeData()->document()->documentLayout());
if(lay)
lay->layout();
KoShapePaintingContext paintContext; //FIXME
textShape.paintComponent(p, zoomHandler, paintContext);
widget.bulletListButton->addItem(pm, static_cast<int> (item.style));
}
}