diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/MainWindow.h | 3 | ||||
-rw-r--r-- | src/ProgressWidget.cc | 2 | ||||
-rw-r--r-- | src/ProgressWidget.h | 4 | ||||
-rw-r--r-- | src/mainwin.cc | 11 |
4 files changed, 17 insertions, 3 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h index 216b7e2..44f2a87 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -62,6 +62,9 @@ private slots: void updateTVal(); void setFileName(const QString &filename); void setFont(const QString &family, uint size); +#ifdef USE_PROGRESSWIDGET + void showProgress(); +#endif private: void openFile(const QString &filename); diff --git a/src/ProgressWidget.cc b/src/ProgressWidget.cc index 0e98286..a386192 100644 --- a/src/ProgressWidget.cc +++ b/src/ProgressWidget.cc @@ -1,4 +1,5 @@ #include "ProgressWidget.h" +#include <QTimer> ProgressWidget::ProgressWidget(QWidget *parent) :QWidget(parent) @@ -6,6 +7,7 @@ ProgressWidget::ProgressWidget(QWidget *parent) setupUi(this); this->wascanceled = false; connect(this->stopButton, SIGNAL(clicked()), this, SLOT(cancel())); + QTimer::singleShot(1000, this, SIGNAL(requestShow())); } bool ProgressWidget::wasCanceled() const diff --git a/src/ProgressWidget.h b/src/ProgressWidget.h index a609dbd..715272b 100644 --- a/src/ProgressWidget.h +++ b/src/ProgressWidget.h @@ -17,9 +17,11 @@ public slots: void setValue(int progress); void cancel(); +signals: + void requestShow(); + private: bool wascanceled; - }; #endif diff --git a/src/mainwin.cc b/src/mainwin.cc index d1a84d2..b277d1f 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -344,6 +344,13 @@ MainWindow::~MainWindow() #endif } +#ifdef USE_PROGRESSWIDGET +void MainWindow::showProgress() +{ + this->statusBar()->addPermanentWidget(qobject_cast<ProgressWidget*>(sender())); +} +#endif + static void report_func(const class AbstractNode*, void *vp, int mark) { #ifdef USE_PROGRESSWIDGET @@ -651,7 +658,7 @@ void MainWindow::compileCSG(bool procevents) ProgressWidget *pd = new ProgressWidget(this); pd->setRange(0, 100); pd->setValue(0); - this->statusBar()->addPermanentWidget(pd); + connect(pd, SIGNAL(requestShow()), this, SLOT(showProgress())); #else QProgressDialog *pd = new QProgressDialog("Rendering CSG products...", "Cancel", 0, 100); pd->setRange(0, 100); @@ -1057,7 +1064,7 @@ void MainWindow::actionRenderCGAL() ProgressWidget *pd = new ProgressWidget(this); pd->setRange(0, 100); pd->setValue(0); - this->statusBar()->addPermanentWidget(pd); + connect(pd, SIGNAL(requestShow()), this, SLOT(showProgress())); #else QProgressDialog *pd = new QProgressDialog("Rendering Polygon Mesh using CGAL...", "Cancel", 0, 100); pd->setRange(0, 100); |