progress bar in nokia Qt?

649 Views Asked by At

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

2

There are 2 best solutions below

0
On

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.

0
On

I can recommend using QProgressDialog instead which pops up centered automatically.