1 Star 0 Fork 1.5K

lineCodeJm / ndd

forked from 爬山虎 / ndd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
progresswin.cpp 1.24 KB
一键复制 编辑 原始数据 按行查看 历史
#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();
}
C++
1
https://gitee.com/lineCodeJm/notepad--.git
git@gitee.com:lineCodeJm/notepad--.git
lineCodeJm
notepad--
ndd
master

搜索帮助