本文整理汇总了C++中QTextListFormat::setProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextListFormat::setProperty方法的具体用法?C++ QTextListFormat::setProperty怎么用?C++ QTextListFormat::setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextListFormat
的用法示例。
在下文中一共展示了QTextListFormat::setProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void KoList::add(const QTextBlock &block, int level)
{
if (!block.isValid())
return;
if (level == 0) { // fetch the first proper level we have
level = 1; // if nothing works...
for (int i = 1; i <= 10; i++) {
if (d->style->hasLevelProperties(i)) {
level = i;
break;
}
}
}
remove(block);
QTextList *textList = d->textLists.value(level-1).data();
if (!textList) {
QTextCursor cursor(block);
QTextListFormat format = d->style->listFormat(level);
if (continueNumbering(level))
format.setProperty(KListStyle::ContinueNumbering, true);
textList = cursor.createList(format);
format.setProperty(KListStyle::ListId, (KListStyle::ListIdType)(textList));
textList->setFormat(format);
d->textLists[level-1] = textList;
d->textListIds[level-1] = (KListStyle::ListIdType)textList;
} else {
textList->add(block);
}
QTextCursor cursor(block);
QTextBlockFormat blockFormat = cursor.blockFormat();
if (d->style->styleId()) {
blockFormat.setProperty(KParagraphStyle::ListStyleId, d->style->styleId());
} else {
blockFormat.clearProperty(KParagraphStyle::ListStyleId);
}
if (d->type == KoList::TextList) {
blockFormat.clearProperty(KParagraphStyle::ListLevel);
} else {
blockFormat.setProperty(KParagraphStyle::ListLevel, level);
}
cursor.setBlockFormat(blockFormat);
d->invalidate(block);
}
示例2: applyStyle
void KoListLevelProperties::applyStyle(QTextListFormat &format) const
{
QList<int> keys = d->stylesPrivate.keys();
for (int i = 0; i < keys.count(); i++) {
QVariant variant = d->stylesPrivate.value(keys[i]);
format.setProperty(keys[i], variant);
}
}
示例3: updateStoredList
void KoList::updateStoredList(const QTextBlock &block)
{
if (block.textList()) {
int level = block.textList()->format().property(KListStyle::Level).toInt();
QTextList *textList = block.textList();
QTextListFormat format = textList->format();
format.setProperty(KListStyle::ListId, (KListStyle::ListIdType)(textList));
textList->setFormat(format);
d->textLists[level-1] = textList;
d->textListIds[level-1] = (KListStyle::ListIdType)textList;
}
}
示例4: setContinueNumbering
void KoList::setContinueNumbering(int level, bool enable)
{
Q_ASSERT(level > 0 && level <= 10);
level = qMax(qMin(level, 10), 1);
QBitArray bitArray = d->properties[ContinueNumbering].toBitArray();
if (bitArray.isEmpty())
bitArray.resize(10);
bitArray.setBit(level-1, enable);
d->properties[ContinueNumbering] = bitArray;
QTextList *textList = d->textLists.value(level-1).data();
if (!textList)
return;
QTextListFormat format = textList->format();
if (enable) {
format.setProperty(KListStyle::ContinueNumbering, true);
} else {
format.clearProperty(KListStyle::ContinueNumbering);
}
textList->setFormat(format);
}