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


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

本文整理汇总了C++中ProgressBar::setRange方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::setRange方法的具体用法?C++ ProgressBar::setRange怎么用?C++ ProgressBar::setRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgressBar的用法示例。


在下文中一共展示了ProgressBar::setRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MainFrame

  MainFrame()
    : Dialog("ProgressBars")
    , m_progressBar1(this)
    , m_progressBar2(this, ProgressBarStyle + SmoothProgressBarStyle)
    , m_start("Start", this)
    , m_close("Close", this)
  {
    // a box layout manager with vertical orientation and no-homogeneous
    setLayout(new BoxLayout(Orientation::Vertical, false));

    // set the ranges of the progress bars
    m_progressBar1.setRange(0, 100);
    m_progressBar2.setRange(0, 100);

    // the "Start" button is the default one
    m_start.setDefault(true);

    // call "onStart" when the "Start" button is pressed
    m_start.Action.connect(Bind(&MainFrame::onStart, this));

    // the defaultCancelAction of dialogs generates an "WM_CLOSE"
    // message that is converted to the "onClose" event
    m_close.Action.connect(Bind(&MainFrame::defaultCancelAction, this));

    // the application is waiting to work (the user should press the
    // "Start" button)
    m_state = WaitingToWork;

    // set the size of the Frame
    setSize(Size(256, getPreferredSize().h));
    center();
  }
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:32,代码来源:ProgressBars.cpp

示例2: format

void tst_QProgressBar::format()
{
    ProgressBar bar;
    bar.setRange(0, 10);
    bar.setValue(1);
    bar.show();
    QTest::qWaitForWindowShown(&bar);

    QTest::qWait(20);
    bar.repainted = false;
    bar.setFormat("%v of %m (%p%)");
    QTest::qWait(20);
    QTRY_VERIFY(bar.repainted);
    bar.repainted = false;
    bar.setFormat("%v of %m (%p%)");
    qApp->processEvents();

#ifndef Q_WS_MAC
    // Animated scroll bars get paint events all the time
#ifdef Q_OS_WIN
    if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA)
#endif
    QVERIFY(!bar.repainted);
#endif

    QCOMPARE(bar.text(), QString("1 of 10 (10%)"));
    bar.setRange(5, 5);
    bar.setValue(5);
    QCOMPARE(bar.text(), QString("5 of 0 (100%)"));
    bar.setRange(0, 5);
    bar.setValue(0);
    bar.setRange(5, 5);
    QCOMPARE(bar.text(), QString());
}
开发者ID:Blizzard,项目名称:qt4,代码行数:34,代码来源:tst_qprogressbar.cpp

示例3: MainFrame

  MainFrame()
    : Dialog(L"ProgressBars")
    , m_progressBar1(this)
    , m_progressBar2(this, ProgressBar::Styles::Default +
			   ProgressBar::Styles::Smooth)
    , m_progressBar3(this, ProgressBar::Styles::Default +
			   ProgressBar::Styles::Marquee)
    , m_start(L"Start", this)
    , m_close(L"Close", this)
  {
    // a box layout manager with vertical orientation and no-homogeneous
    setLayout(new BoxLayout(Orientation::Vertical, false));

    // set the ranges of the progress bars
    m_progressBar1.setRange(0, 100);
    m_progressBar2.setRange(0, 100);
    m_progressBar3.setMarquee(0);

    // the "Start" button is the default one
    m_start.setDefault(true);

    // call "onStart" when the "Start" button is pressed
    m_start.Click.connect(Bind(&MainFrame::onStart, this));

    // the Dialog::onCancel generates an onClose event
    m_close.Click.connect(Bind(&MainFrame::onCancel, this));

    // the application is waiting to work (the user should press the
    // "Start" button)
    m_state = WaitingToWork;

    // set the size of the Frame
    setSize(Size(256, getPreferredSize().h));
    center();
  }
开发者ID:Jmos,项目名称:vaca,代码行数:35,代码来源:ProgressBars.cpp


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