In post QProgress Bar-Time Measuring is used a known time. How do I do if I do not know the time?
I have a program that read a file with many lines. This program takes the first line and test whether it is equal to some other line of the file. Take the next does the same thing to the end. But the program hangs and only responds when you finish the test.
I would like a QProgressBar controlling it. But I have no idea.
Someone help me? Thanks.
while (!in.atEnd()) {
novo:
line = in.readLine();
next = in.pos();
test.clear();
test
= line.
split(QRegExp("\\s+"));
zero = test[2].toFloat(&ok);
zero2 = test[3].toFloat(&ok2);
if(!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || test.size() <= 3){
if(in.atEnd()){
continue;
}else {
goto novo;
}
}else {
junto = test[2] + test[3];
while (!in.atEnd()) {
line = in.readLine();
comp.clear();
comp
= line.
split(QRegExp("\\s+"));
zero = comp[2].toFloat(&ok);
zero2 = comp[3].toFloat(&ok2);
if (!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || comp.size() <= 3){
//relout << comp.size() << "Comp " << comp[3] << endl;
if (varrer.atEnd())
break;
else
continue;
}else if (junto == comp[2]+comp[3]){
relout << "Equal: Line " << comp[2] << " PT " << comp[3] << endl;
file.close();
break;
//return;
}
}
in.seek(next);
}
}
while (!in.atEnd()) {
novo:
line = in.readLine();
next = in.pos();
test.clear();
test = line.split(QRegExp("\\s+"));
zero = test[2].toFloat(&ok);
zero2 = test[3].toFloat(&ok2);
if(!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || test.size() <= 3){
if(in.atEnd()){
continue;
}else {
goto novo;
}
}else {
junto = test[2] + test[3];
while (!in.atEnd()) {
line = in.readLine();
comp.clear();
comp = line.split(QRegExp("\\s+"));
zero = comp[2].toFloat(&ok);
zero2 = comp[3].toFloat(&ok2);
if (!ok || !ok2 || zero == 0.0 || zero2 == 0.0 || comp.size() <= 3){
//relout << comp.size() << "Comp " << comp[3] << endl;
if (varrer.atEnd())
break;
else
continue;
}else if (junto == comp[2]+comp[3]){
relout << "Equal: Line " << comp[2] << " PT " << comp[3] << endl;
file.close();
break;
//return;
}
}
in.seek(next);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks