本文整理汇总了C++中QAbstractScrollArea::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractScrollArea::resize方法的具体用法?C++ QAbstractScrollArea::resize怎么用?C++ QAbstractScrollArea::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractScrollArea
的用法示例。
在下文中一共展示了QAbstractScrollArea::resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QCOMPARE
void tst_QAbstractScrollArea::setScrollBars2()
{
QAbstractScrollArea scrollArea;
scrollArea.resize(300, 300);
QScrollBar *hbar = new QScrollBar;
scrollArea.setHorizontalScrollBar(hbar);
qApp->processEvents();
QCOMPARE(scrollArea.horizontalScrollBar(), hbar);
QScrollBar *vbar = new QScrollBar;
scrollArea.setVerticalScrollBar(vbar);
qApp->processEvents();
QCOMPARE(scrollArea.verticalScrollBar(), vbar);
scrollArea.horizontalScrollBar()->setRange(0, 100);
scrollArea.verticalScrollBar()->setRange(0, 100);
scrollArea.show();
// Make sure scroll bars are not explicitly hidden by QAbstractScrollArea itself.
QVERIFY(hbar->isVisible());
QVERIFY(vbar->isVisible());
// Hide the OLD scroll bar and ensure that the NEW one is hidden.
hbar->hide();
scrollArea.setHorizontalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.horizontalScrollBar()->isVisible());
vbar->hide();
scrollArea.setVerticalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.verticalScrollBar()->isVisible());
scrollArea.verticalScrollBar()->show();
scrollArea.horizontalScrollBar()->show();
// Hide the NEW scroll bar and ensure that it's visible
// (because the OLD one is visible).
hbar = new QScrollBar;
hbar->hide();
scrollArea.setHorizontalScrollBar(hbar);
qApp->processEvents();
QVERIFY(hbar->isVisible());
vbar = new QScrollBar;
vbar->hide();
scrollArea.setVerticalScrollBar(vbar);
qApp->processEvents();
QVERIFY(vbar->isVisible());
vbar->setRange(0, 0);
qApp->processEvents();
QVERIFY(!vbar->isVisible());
hbar->setRange(0, 0);
qApp->processEvents();
QVERIFY(!hbar->isVisible());
}