本文整理汇总了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();
}
示例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());
}
示例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();
}