本文整理汇总了C++中KoParagraphStyle::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ KoParagraphStyle::setName方法的具体用法?C++ KoParagraphStyle::setName怎么用?C++ KoParagraphStyle::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoParagraphStyle
的用法示例。
在下文中一共展示了KoParagraphStyle::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testApplyParagraphStyle
void TestStyles::testApplyParagraphStyle()
{
KoParagraphStyle style;
style.setStyleId(1001);
QTextBlockFormat format;
QCOMPARE(format.properties().count(), 0);
style.applyStyle(format);
QCOMPARE(format.properties().count(), 2); // the styleId and nextStyleId
QCOMPARE(format.property(KoParagraphStyle::StyleId).toInt(), 1001);
QCOMPARE(format.property(KoParagraphStyle::NextStyle).toInt(), 1001);
style.setName("name");
style.setAlignment(Qt::AlignRight);
style.applyStyle(format);
QCOMPARE(format.properties().count(), 3);
QCOMPARE(format.alignment(), Qt::AlignRight);
}