本文整理汇总了C++中ProgressBar::setMaximum方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::setMaximum方法的具体用法?C++ ProgressBar::setMaximum怎么用?C++ ProgressBar::setMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::setMaximum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMinMaxRepaint
void tst_QProgressBar::setMinMaxRepaint()
{
ProgressBar pbar;
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
pbar.show();
QVERIFY(QTest::qWaitForWindowActive(&pbar));
// No repaint when setting minimum to the current minimum
pbar.repainted = false;
pbar.setMinimum(0);
QTest::qWait(50);
QTRY_VERIFY(!pbar.repainted);
// No repaint when setting maximum to the current maximum
pbar.repainted = false;
pbar.setMaximum(10);
QTest::qWait(50);
QTRY_VERIFY(!pbar.repainted);
// Repaint when setting minimum
for (int i = 9; i >= 0; i--) {
pbar.repainted = false;
pbar.setMinimum(i);
QTRY_VERIFY(pbar.repainted);
}
// Repaint when setting maximum
for (int i = 0; i < 10; ++i) {
pbar.repainted = false;
pbar.setMaximum(i);
QTRY_VERIFY(pbar.repainted);
}
}
示例2: sizeHint
void tst_QProgressBar::sizeHint()
{
ProgressBar bar;
bar.setMinimum(0);
bar.setMaximum(10);
bar.setValue(5);
//test if the sizeHint is big enough
QFontMetrics fm = bar.fontMetrics();
QStyleOptionProgressBarV2 opt;
bar.initStyleOption(&opt);
QSize size = QSize(9 * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8);
size= bar.style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, &bar);
QSize barSize = bar.sizeHint();
QVERIFY(barSize.width() >= size.width());
QCOMPARE(barSize.height(), size.height());
}
示例3: setValueRepaint
void tst_QProgressBar::setValueRepaint()
{
ProgressBar pbar;
pbar.setMinimum(0);
pbar.setMaximum(10);
pbar.setFormat("%v");
pbar.show();
QTest::qWaitForWindowShown(&pbar);
QApplication::processEvents();
for (int i = pbar.minimum(); i < pbar.maximum(); ++i) {
pbar.repainted = false;
pbar.setValue(i);
QTest::qWait(50);
QTRY_VERIFY(pbar.repainted);
}
}
示例4: ProgressBar
void
BrowserMessageArea::newProgressOperation( QObject *sender, const QString &text, int maximum,
QObject *obj, const char *slot, Qt::ConnectionType type )
{
ProgressBar *newBar = new ProgressBar( 0 );
newBar->setDescription( text );
newBar->setMaximum( maximum );
connect( sender, SIGNAL(destroyed( QObject * )), m_progressBar,
SLOT(endProgressOperation( QObject * )) );
connect( sender, SIGNAL(endProgressOperation( QObject * )), m_progressBar,
SLOT(endProgressOperation( QObject * )) );
connect( sender, SIGNAL(incrementProgress()), m_progressBar,
SLOT(slotIncrementProgress()) );
connect( sender, SIGNAL(totalSteps( int )), newBar, SLOT(slotTotalSteps( int )) );
newBar->setAbortSlot( obj, slot, type );
m_progressBar->addProgressBar( newBar, sender );
m_progressBar->show();
m_busy = true;
}