本文整理汇总了C++中KoParagraphStyle::styleId方法的典型用法代码示例。如果您正苦于以下问题:C++ KoParagraphStyle::styleId方法的具体用法?C++ KoParagraphStyle::styleId怎么用?C++ KoParagraphStyle::styleId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoParagraphStyle
的用法示例。
在下文中一共展示了KoParagraphStyle::styleId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAddRemoveParagraphStyle
void TestStyleManager::testAddRemoveParagraphStyle()
{
// Add paragraph style.
KoParagraphStyle paragraphStyle;
paragraphStyle.setName("Test Paragraph Style");
QSignalSpy addSignalSpy(m_styleManager, SIGNAL(styleAdded(KoParagraphStyle*)));
m_styleManager->beginEdit();
m_styleManager->add(¶graphStyle);
m_styleManager->endEdit();
QVERIFY(paragraphStyle.styleId() > 0);
QVERIFY(!m_styleManager->usedParagraphStyles().contains(paragraphStyle.styleId()));
QCOMPARE(m_styleManager->paragraphStyles().count(¶graphStyle), 1);
QCOMPARE(m_styleManager->paragraphStyle(paragraphStyle.styleId()), ¶graphStyle);
QCOMPARE(m_styleManager->paragraphStyle("Test Paragraph Style"), ¶graphStyle);
QCOMPARE(addSignalSpy.count(), 1);
QCOMPARE(addSignalSpy.at(0).at(0).value<KoParagraphStyle *>(), ¶graphStyle);
// Remove paragraph style.
QSignalSpy removeSignalSpy(m_styleManager, SIGNAL(styleRemoved(KoParagraphStyle*)));
m_styleManager->beginEdit();
m_styleManager->remove(¶graphStyle);
m_styleManager->endEdit();
QVERIFY(!m_styleManager->paragraphStyles().contains(¶graphStyle));
QVERIFY(!m_styleManager->paragraphStyle(paragraphStyle.styleId()));
QVERIFY(!m_styleManager->paragraphStyle("Test Paragraph Style"));
QCOMPARE(removeSignalSpy.count(), 1);
QCOMPARE(removeSignalSpy.at(0).at(0).value<KoParagraphStyle *>(), ¶graphStyle);
}
示例2: styleNameToStyleId
int KoBibliographyInfo::styleNameToStyleId(KoTextSharedLoadingData *sharedLoadingData, const QString &styleName)
{
KoParagraphStyle * style = sharedLoadingData->paragraphStyle(styleName, true);
if (style) {
return style->styleId();
}
return 0;
}
示例3: testAddAppliedParagraphStyle
void TestStyleManager::testAddAppliedParagraphStyle()
{
// Create style, apply it, then add it to the manager.
KoParagraphStyle paragraphStyle;
QTextBlock block = m_doc->begin();
paragraphStyle.applyStyle(block);
m_styleManager->beginEdit();
m_styleManager->add(¶graphStyle);
m_styleManager->endEdit();
// Check that style is marked as used.
QVERIFY(m_styleManager->usedParagraphStyles().contains(paragraphStyle.styleId()));
}
示例4: createMapping
void ValidParentStylesProxyModel::createMapping()
{
if (!m_styleManager || !m_sourceModel) {
return;
}
m_sourceToProxy.clear();
m_proxyToSource.clear();
for(int i = 0; i < m_sourceModel->rowCount(QModelIndex()); ++i) {
QModelIndex index = m_sourceModel->index(i, 0, QModelIndex());
int id = (int)index.internalId();
KoParagraphStyle *paragraphStyle = m_styleManager->paragraphStyle(id);
if (paragraphStyle) {
bool ok = true;
KoParagraphStyle *testStyle = paragraphStyle;
while (testStyle && ok) {
ok = testStyle->styleId() != m_currentChildStyleId;
testStyle = testStyle->parentStyle();
}
if (!ok) {
continue; //we cannot inherit ourself even indirectly through the parent chain
}
m_proxyToSource.append(i); //the style is ok for parenting
}
else {
KoCharacterStyle *characterStyle = m_styleManager->characterStyle(id);
if (characterStyle) {
bool ok = true;
KoCharacterStyle *testStyle = characterStyle;
while (testStyle && ok) {
ok = testStyle->styleId() != m_currentChildStyleId;
testStyle = testStyle->parentStyle();
}
if (!ok) {
continue; //we cannot inherit ourself even indirectly through the parent chain
}
m_proxyToSource.append(i); //the style is ok for parenting
}
}
}
m_sourceToProxy.fill(-1, m_sourceModel->rowCount(QModelIndex()));
for(int i = 0; i < m_proxyToSource.count(); ++i) {
m_sourceToProxy[m_proxyToSource.at(i)] = i;
}
}
示例5: testApplyAddedParagraphStyle
void TestStyleManager::testApplyAddedParagraphStyle()
{
QSignalSpy appliedSignalSpy(m_styleManager, SIGNAL(styleApplied(const KoParagraphStyle*)));
// Create style, add it to the manager, then apply it.
KoParagraphStyle paragraphStyle;
m_styleManager->beginEdit();
m_styleManager->add(¶graphStyle);
m_styleManager->endEdit();
QTextBlock block = m_doc->begin();
paragraphStyle.applyStyle(block);
// Check that style is marked as used and that the correct signal was emitted.
QVERIFY(m_styleManager->usedParagraphStyles().contains(paragraphStyle.styleId()));
QCOMPARE(appliedSignalSpy.count(), 1);
QCOMPARE(appliedSignalSpy.at(0).at(0).value<const KoParagraphStyle *>(), ¶graphStyle);
}
示例6: styleNameToStyleId
int KoTableOfContentsGeneratorInfo::styleNameToStyleId(KoTextSharedLoadingData *sharedLoadingData, QString styleName)
{
//find styleId of a style based on its style:name property
KoParagraphStyle * style = sharedLoadingData->paragraphStyle(styleName, true);
if (style) {
return style->styleId();
}
//if the previous way of finding styles fails fall back on using style:display-name property of a style
QList<KoParagraphStyle *> paragraphStyles = sharedLoadingData->paragraphStyles(true);
QList<KoParagraphStyle *>::const_iterator iter = paragraphStyles.constBegin();
for (; iter != paragraphStyles.constEnd(); ++iter) {
if ((*iter)->name() == styleName) {
return (*iter)->styleId();
}
}
return 0;
}