简体   繁体   中英

progress bar in nokia Qt?

I'm using progress bar in my app. when i navigating first widget to second widget and in-between i'm using progress bar in another widget.

 //code:
    progressform *pgm = new progressform(); // calling progress bar widget
    pgm->adjustSize();
    pgm->show();
    for(int i=24;i<=100;i++) //initial setvalue is 24
    {
        pgm->ui->progressBar->setValue(i);
     }
    detailWidget *dwt = new  detailWidget(); // calling detail widget

    dwt->show();

Before going to detailwidget i called progressform(widget) and after that the progressbar setvalue reach 100 it moves to detailwidget. the problem is i cant resize the progress widget in to center of the screen like popup screen and I want to sleep time because i want to see the progress value increased one by one?

Thanks in advance

我可以建议使用QProgressDialog代替,它会自动居中弹出。

You'll have to center your progress bar manually. Popup screens do so automatically, but progress bars normally are used as part of a dialog. Therefore they are positioned by the dialog layout.

As for the sleeping, that's probably a design error. If your task is so fast you'd need a sleep just to see the progress bar, you shouldn't have a progress bar in the first place.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM