本文整理汇总了C++中ProgressBar类的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar类的具体用法?C++ ProgressBar怎么用?C++ ProgressBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d8_flow_directions
void d8_flow_directions(
const Array2D<T> &elevations,
Array2D<U> &flowdirs
){
ProgressBar progress;
std::cerr<<"A D8 Flow Directions"<<std::endl;
std::cerr<<"C TODO"<<std::endl;
std::cerr<<"p Setting up the flow directions matrix..."<<std::endl;
flowdirs.resize(elevations);
flowdirs.setAll(NO_FLOW);
flowdirs.setNoData(FLOWDIR_NO_DATA);
std::cerr<<"p Calculating D8 flow directions..."<<std::endl;
progress.start( elevations.width()*elevations.height() );
#pragma omp parallel for
for(int y=0;y<elevations.height();y++){
progress.update( y*elevations.width() );
for(int x=0;x<elevations.width();x++)
if(elevations(x,y)==elevations.noData())
flowdirs(x,y) = flowdirs.noData();
else
flowdirs(x,y) = d8_FlowDir(elevations,x,y);
}
std::cerr<<"t Succeeded in = "<<progress.stop()<<" s"<<std::endl;
}
示例2: d8_flow_directions
void d8_flow_directions(
const array2d<T> &elevations,
array2d<U> &flowdirs
){
ProgressBar progress;
diagnostic("Setting up the flow directions matrix...");
flowdirs.copyprops(elevations);
flowdirs.init(NO_FLOW);
flowdirs.no_data=d8_NO_DATA;
diagnostic("succeeded.\n");
diagnostic("%%Calculating D8 flow directions...\n");
progress.start( elevations.width()*elevations.height() );
#pragma omp parallel for
for(int x=0;x<elevations.width();x++){
progress.update( x*elevations.height() );
for(int y=0;y<elevations.height();y++)
if(elevations(x,y)==elevations.no_data)
flowdirs(x,y)=flowdirs.no_data;
else
flowdirs(x,y)=d8_FlowDir(elevations,x,y);
}
diagnostic_arg(SUCCEEDED_IN,progress.stop());
}
示例3: common_create_progress_dlg
static progdlg_t *
common_create_progress_dlg(bool animate, const gpointer top_level_window,
gboolean terminate_is_stop, gboolean *stop_flag,
int value)
{
ProgressBar *pb;
QWidget *main_window;
if (!top_level_window) {
return NULL;
}
main_window = qobject_cast<QWidget *>((QObject *)top_level_window);
if (!main_window) {
return NULL;
}
pb = main_window->findChild<ProgressBar *>();
if (!pb) {
return NULL;
}
return pb->show(animate, terminate_is_stop, stop_flag, value);
}
示例4: ProgressBar
void GenericSolver::buildInteractionMatrix(ReactiveSet& R) {
if(verbose) printf("Building interaction matrix for %i DF...\n", R.nDF());
ProgressBar pb = ProgressBar(R.nDF(),1,verbose);
#ifdef WITH_LAPACKE
the_ixn = mmat(R.nDF(),R.nDF());
#else
the_GF = gsl_matrix_alloc(R.nDF(),R.nDF());
#endif
R.startInteractionScan();
for(unsigned int DF=0; DF<R.nDF(); DF++) {
R.setInteractionDF(DF,1.0);
for(unsigned int phi=0; phi<R.nPhi; phi++) {
mvec v = R.getReactionTo(&R,phi);
assert(v.size() == R.nDF()/R.nPhi);
for(unsigned int i=0; i<v.size(); i++)
#ifdef WITH_LAPACKE
the_ixn(i*R.nPhi+phi, DF) = v[i];
#else
gsl_matrix_set(the_GF, i*R.nPhi+phi, DF, (i*R.nPhi+phi==DF) ? 1-v[i] : -v[i]);
#endif
}
pb.update(DF);
}
R.setInteractionDF(R.nDF(),0);
}
示例5: 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();
}
示例6: ProgressBar
ProgressBar* ProgressBar::create(ProgressDelegate* target, CCSprite *sprite)
{
ProgressBar* progress = new ProgressBar();
progress->init(target, sprite);
progress->autorelease();
return progress;
}
示例7: 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();
}
示例8: installTheme
void ProgressBarTheme::installTheme(Component *comp)
{
ProgressBar *progressBar = static_cast<ProgressBar*>(comp);
// progressBar->setBackground(&background);
// progressBar->setForeground(&foreground);
progressBar->setFont(SchemeManager::getInstance().getScheme()->getDefaultFont()); // default font
progressBar->setBorder(&border);
}
示例9: TEST
TEST(ProgressBar, BasicTest)
{
ProgressBar pb;
for (int i = 0; i <= 100; ++i){
pb.setValue(i);
EXPECT_EQ(i, pb.value());
System::msleep(10);
}
}
示例10: on_marquee_progress
void ProgressBar_Impl::on_marquee_progress()
{
marquee_position += marquee_step_size;
if(marquee_position > progressbar->get_width())
marquee_position = -marquee_box_width;
progressbar->request_repaint();
}
示例11: 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);
}
}
示例12: getLookNFeel
void FalagardProgressBarEx::render()
{
const StateImagery* imagery;
// get WidgetLookFeel for the assigned look.
const WidgetLookFeel& wlf = getLookNFeel();
// try and get imagery for our current state
imagery = &wlf.getStateImagery(d_window->isDisabled() ? "Disabled" : "Enabled");
// peform the rendering operation.
imagery->render(*d_window);
// get imagery for actual progress rendering
imagery = &wlf.getStateImagery(d_window->isDisabled() ? "DisabledProgress" : "EnabledProgress");
// get target rect for this imagery
Rect progressRect(wlf.getNamedArea("ProgressArea").getArea().getPixelRect(*d_window));
// calculate a clipper according to the current progress.
Rect progressClipper(progressRect);
ProgressBar* w = (ProgressBar*)d_window;
if (d_vertical)
{
float height = PixelAligned(progressClipper.getHeight() * w->getProgress());
if (d_reversed)
{
progressClipper.setHeight(height);
}
else
{
progressClipper.d_top = progressClipper.d_bottom - height;
}
}
else
{
float width = PixelAligned(progressClipper.getWidth() * w->getProgress());
if (d_reversed)
{
progressClipper.d_left = progressClipper.d_right - width;
}
else
{
progressClipper.setWidth(width);
}
}
// peform the rendering operation.
imagery->render(*d_window, progressRect, 0, &progressClipper);
// perform the text rendering operation
imagery = &wlf.getStateImagery("Label");
imagery->render(*d_window);
}
示例13: ProgressBar
//.static
ProgressBar * ProgressBar::create( const CCRect &area )
{
ProgressBar* bar = new ProgressBar();
if(!bar->init(area))
{
delete bar;
return NULL;
}
bar->autorelease();
return bar;
}
示例14: main
int main (int argc, char ** argv) {
H.init ("Random triangulation", argc,argv, "n=10,t=-1");
int t = H['t']; if (t==-1) t=50*int(H['n'])*int(H['n']);
Triangulation T (H['n']); T.inscribe(T.face(Edge(0,1)));
{ ProgressBar P (t); for (int i=0; i<t; ++i) { T.flip(T.random_edge()); P.set(i); } }
T.show();
T.inscribe (T.face (Edge (0,*(T.v[0]->adj.begin())))); T.balance_old(); T.pause();
std::cout << T;
}
示例15: TEST
TEST(ProgressBar, BasicTest)
{
if (!Application::instance().hasApplication()){
Application::instance().application(true);
}
if (Application::instance().hasGUI()){
ProgressBar pb;
for (int i = 0; i <= 100; ++i){
pb.setValue(i);
EXPECT_EQ(i, pb.value());
System::msleep(10);
}
}
}