Search code examples
qtqt4symbianprogress-bar

Trouble with progressbar in QT


i m facing problem in giving animation to progressbar in QT.

where is the mistake in the following code, i am getting continues progress bar, but its not animating

  QApplication a(argc, argv);

QProgressDialog *dialog = new QProgressDialog();


QProgressBar *pbar = new QProgressBar(dialog);

pbar->setMinimum(0);
pbar->setMaximum(0);
pbar->setTextVisible(false);

QDesktopWidget *desktop = QApplication::desktop();
QRect rect = desktop->geometry();

pbar->setGeometry(rect.left(),rect.top(),rect.right(),rect.bottom()-300);

pbar->show();


dialog->setBar(pbar);

dialog->showMaximized(); 
dialog->exec();   
return a.exec();

Solution

  • I tried this code on WinXP with Qt 4.5.3 and it works as expected. I cannot give you a solution but i have a suggestion: You don't need to set a QProgressBar to QProgressDialog, it already has its own.

    Removing the code for QProgressBar, the code below does the same thing with your original code on my machine.

    QApplication a(argc, argv);
    
    QProgressDialog *dialog = new QProgressDialog();
    
    dialog->setMinimum(0);
    dialog->setMaximum(0);
    
    dialog->showMaximized(); 
    dialog->exec();   
    return a.exec();