| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #include "progresswin.h"
- #include <QCoreApplication>
- #include <QMessageBox>
- ProgressWin::ProgressWin(QWidget *parent)
- : QDialog(parent), m_curStep(0),m_isCancel(false)
- {
- ui.setupUi(this);
- }
- ProgressWin::~ProgressWin()
- {
- }
- void ProgressWin::info(QString text)
- {
- ui.output->append(text);
- }
- void ProgressWin::setTotalSteps(int step)
- {
- ui.progressBar->setValue(0);
- ui.progressBar->setMaximum(step);
- m_curStep = 0;
- }
- void ProgressWin::moveStep()
- {
- ++m_curStep;
- ui.progressBar->setValue(m_curStep);
- ui.progressBar->update();
- //QCoreApplication::processEvents();
- }
- int ProgressWin::getTotalStep()
- {
- return ui.progressBar->maximum();
- }
- void ProgressWin::setStep(int step)
- {
- ui.progressBar->setValue(step);
- ui.progressBar->update();
- m_curStep = step;
- //QCoreApplication::processEvents();
- }
- bool ProgressWin::isCancel()
- {
- return m_isCancel;
- }
- void ProgressWin::setCancel()
- {
- m_isCancel = true;
- emit quitClick();
- }
- void ProgressWin::closeEvent(QCloseEvent* e)
- {
- e->ignore();
- }
- void ProgressWin::slot_quitBt()
- {
- if (QMessageBox::Yes != QMessageBox::question(this, tr("Notice"), tr("Are you sure to cancel?")))
- {
- return;
- }
- m_isCancel = true;
- emit quitClick();
- }
|