本文整理汇总了C++中KWPage::height方法的典型用法代码示例。如果您正苦于以下问题:C++ KWPage::height方法的具体用法?C++ KWPage::height怎么用?C++ KWPage::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KWPage
的用法示例。
在下文中一共展示了KWPage::height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: style
void TestPageCommands::testPageStylePropertiesCommand2()
{
/*
make setup where multiple, interspaced pages use the style we want to change.
add some frames.
check if the frames moved properly when the page gets a new size
check that all pages got their new size
check that the name of the style did not change
*/
KWDocument document;
KWPageManager *manager = document.pageManager();
KWPageStyle style("pagestyle1");
KoPageLayout lay = style.pageLayout();
lay.width = 300;
lay.height = 500;
style.setPageLayout(lay);
KWPageStyle style2("pagestyle2");
lay = style.pageLayout();
lay.width = 400;
lay.height = 400;
style2.setPageLayout(lay);
KWPage p1 = manager->appendPage(style2);
KWPage p2 = manager->appendPage(style);
KWPage p3 = manager->appendPage(style);
KWPage p4 = manager->appendPage(style2);
KWPage p5 = manager->appendPage(style2);
KWPage p6 = manager->appendPage(style);
KWPage p7 = manager->appendPage(style);
KWPage p8 = manager->appendPage(style);
KWPage p9 = manager->appendPage(style2);
QCOMPARE(manager->pageCount(), 9);
KWFrameSet *fs = new KWFrameSet();
for (int i = 1; i <= manager->pageCount(); ++i) {
// create one frame per page. Positioned relative to the top of the page.
KWPage page = manager->page(i);
QVERIFY(page.isValid());
MockShape *shape = new MockShape();
new KWFrame(shape, fs);
shape->setPosition(QPointF(-10, page.offsetInDocument() + 10));
}
document.addFrameSet(fs);
// lets prepare to change the style to a new page size.
KWPageStyle newStyle("foo");
lay = newStyle.pageLayout();
lay.width = 350;
lay.height = 1000;
newStyle.setPageLayout(lay);
KWPageStylePropertiesCommand command(&document, style, newStyle);
// nothing happens in constructor before redo;
for (int i = 1; i <= manager->pageCount(); ++i) {
KWPage page = manager->page(i);
QVERIFY(page.height() <= 500); // not 1000 yet
QVERIFY(page.isValid());
KoShape *shape = fs->frames().at(i-1)->shape();
QCOMPARE(shape->position(), QPointF(-10, page.offsetInDocument() + 10));
}
const qreal lastPageOffset = p9.offsetInDocument();
command.redo();
QCOMPARE(manager->pageCount(), 9);
QCOMPARE(p1.height(), 400.);
QCOMPARE(p4.height(), 400.);
QCOMPARE(p5.height(), 400.);
QCOMPARE(p9.height(), 400.);
QCOMPARE(p2.height(), 1000.);
QCOMPARE(p3.height(), 1000.);
QCOMPARE(p6.height(), 1000.);
QCOMPARE(p7.height(), 1000.);
QCOMPARE(p8.height(), 1000.);
QCOMPARE(lastPageOffset + 2500, p9.offsetInDocument());
for (int i = 1; i <= manager->pageCount(); ++i) {
KWPage page = manager->page(i);
QVERIFY(page.isValid());
KoShape *shape = fs->frames().at(i-1)->shape();
QCOMPARE(shape->position(), QPointF(-10, page.offsetInDocument() + 10));
}
}
示例2: thumbnail
QImage TextContentsModelImpl::thumbnail(int index, int width) const
{
KWPage page = d->document->pageManager()->page( index + 1 );
return page.thumbnail(QSize{ width, int((page.height() / page.width()) * width)}, d->canvas->shapeManager());
}