I want have indicator for my process. So i use a signal for update the progressbar value
//header MakanPakeSambal
signals:
updateProgress(qint64, qint64);
//header MakanPakeSambal
signals:
updateProgress(qint64, qint64);
To copy to clipboard, switch view to plain text mode
//code MakanPakeSambal
qDebug
() <<
"Start : " <<
QTime::currentTime().
toString("h:m:s");
qint64 ukuran=_inFileinfo.size();
qint64 i=0;
while(_inFile.getChar(&c))
{
outFile.putChar(c);
emit updateProgress(ukuran, i);
i++;
}
qDebug
() <<
"End : " <<
QTime::currentTime().
toString("h:m:s");
//code MakanPakeSambal
qDebug() << "Start : " << QTime::currentTime().toString("h:m:s");
qint64 ukuran=_inFileinfo.size();
qint64 i=0;
while(_inFile.getChar(&c))
{
outFile.putChar(c);
emit updateProgress(ukuran, i);
i++;
}
qDebug() << "End : " << QTime::currentTime().toString("h:m:s");
To copy to clipboard, switch view to plain text mode
And I use like this
ui(new Ui::Dialog)
{
ui->setupUi(this);
mps=new MakanPakeSambal();
connect(mps, SIGNAL(updateProgress(qint64,qint64)), this, SLOT(load(qint64, qint64)));
}
void Dialog::load(qint64 max, qint64 curr)
{
ui->load->setMaximum(max);
ui->load->setValue(curr);
}
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
mps=new MakanPakeSambal();
connect(mps, SIGNAL(updateProgress(qint64,qint64)), this, SLOT(load(qint64, qint64)));
}
void Dialog::load(qint64 max, qint64 curr)
{
ui->load->setMaximum(max);
ui->load->setValue(curr);
}
To copy to clipboard, switch view to plain text mode
This is qDebug result without emit signal
Start : "18:3:28"
End : "18:3:42"
And with emit signal
Start : "18:4:20"
End : "18:12:15"
My method for get the progress value is wrong ?
Bookmarks