Nar*_*uto 1 qt symbian qt4 progress-bar
即将面临在QT中为动画提供动画的问题.
以下代码中的错误在哪里,我得到了继续进度条,但它没有动画
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();
Run Code Online (Sandbox Code Playgroud)
我在Qt 4.5.3的WinXP上尝试了这个代码,它按预期工作.我不能给你一个解决方案,但我有一个建议:你不需要设置QProgressBar到QProgressDialog,它已经有自己的.
删除QProgressBar的代码,下面的代码与我的机器上的原始代码做同样的事情.
QApplication a(argc, argv);
QProgressDialog *dialog = new QProgressDialog();
dialog->setMinimum(0);
dialog->setMaximum(0);
dialog->showMaximized();
dialog->exec();
return a.exec();
Run Code Online (Sandbox Code Playgroud)