#ifdef HAVE_CONFIG_H #include #endif #include "QtProgress.h" using namespace std; MyProgress::MyProgress(QWidget* parent,string text):myprog(0),compute(true),label(text),parent(parent) {} MyProgress::~MyProgress() {if (myprog!=0) delete myprog;} bool MyProgress::progress(int i,int j) { if (myprog==0) { myprog = new QProgressDialog(label.c_str(), "Cancel", 10, parent, "progress", true); connect(myprog, SIGNAL(cancelled()), this, SLOT(stopCompute())); } myprog->show(); myprog->setTotalSteps(j); myprog->setProgress (i); return compute; } void MyProgress::stopCompute(){ compute=false; }