You don't need to call show() every time you updated the value. What are the actual values of "somevalue" that you "obtained"? Are they in the range 0 to 100000?
This, for example, works fine:
#include <QtGui>
int main(int argc, char *argv[])
{
pd.setRange(0,100000);
pd.setLabelText("Long calculations...");
pd.setValue(0);
pd.show();
for (int i = 0; i < 100000000; ++i) {
if (i % 1000 == 0) {
int somevalue = i / 1000;
pd.setValue(somevalue);
}
}
}
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QProgressDialog pd;
pd.setRange(0,100000);
pd.setLabelText("Long calculations...");
pd.setValue(0);
pd.show();
for (int i = 0; i < 100000000; ++i) {
if (i % 1000 == 0) {
int somevalue = i / 1000;
pd.setValue(somevalue);
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks