当前位置: 首页>>代码示例>>C++>>正文


C++ ProgressBar::setMaximum方法代码示例

本文整理汇总了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);
    }
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:35,代码来源:tst_qprogressbar.cpp

示例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());
}
开发者ID:Blizzard,项目名称:qt4,代码行数:17,代码来源:tst_qprogressbar.cpp

示例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);
    }
}
开发者ID:Blizzard,项目名称:qt4,代码行数:17,代码来源:tst_qprogressbar.cpp

示例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;
}
开发者ID:phalgun,项目名称:amarok-nepomuk,代码行数:20,代码来源:BrowserMessageArea.cpp


注:本文中的ProgressBar::setMaximum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。