Could you help me please, guys?
I have an external application which my Qt program launch on button click. This external program write some data to the file "RES1.dat" (with FLUSH on each iteration) while it's not finished, and my program track "RES1.dat" file changes to increment progressBar:
watcher->addPath("RES1.dat");
connect(watcher,
SIGNAL(fileChanged
(QString)),
this,
SLOT(progressBarIncrement
(QString)));
void MainWindow
::progressBarIncrement(QString unused
) { counter += 1; // global parameter
ui->progressBar->setValue( counter );
}
QFileSystemWatcher *watcher = new QFileSystemWatcher(this);
watcher->addPath("RES1.dat");
connect(watcher,SIGNAL(fileChanged(QString)),this,SLOT(progressBarIncrement(QString)));
void MainWindow::progressBarIncrement(QString unused) {
counter += 1; // global parameter
ui->progressBar->setValue( counter );
}
To copy to clipboard, switch view to plain text mode
ProgressBar and external application declaration:
counter=0; // global parameter
ui->progressBar->setMinimum(0);
ui->progressBar->setMaximum((int((datMain[5]-datMain[4])/datMain[6])+1));
ui->progressBar->setValue(0);
/* Search for .exe file */
/*****************/
proc->start(exeFile[0]);
connect(proc,SIGNAL(finished(int)),this,SLOT(fillPlots(int)));
counter=0; // global parameter
ui->progressBar->setMinimum(0);
ui->progressBar->setMaximum((int((datMain[5]-datMain[4])/datMain[6])+1));
ui->progressBar->setValue(0);
QProcess* proc = new QProcess(this);
/* Search for .exe file */
QStringList nameFilter("*.exe");
QDir directory("");
QStringList exeFile = directory.entryList(nameFilter);
/*****************/
proc->start(exeFile[0]);
connect(proc,SIGNAL(finished(int)),this,SLOT(fillPlots(int)));
To copy to clipboard, switch view to plain text mode
The problem is that everything works fine on a computer where i build a programm (i have 1%,2%,...,100% progress fast and smoothly), but when i transfer my program (static build) to another computer, or even change the user on my own computer this progress goes slow and incorrect (it goes 1%,2%,...~31% and then suddenly 100%). BUT if i rebuild my programm under this user (not tested on other computers) then it goes as it should - fast and smoothly to 100%.
So I want universal static build with correct progress, but it seems that it is correct only after rebuilding on a specific computer. What is wrong with my code, and what can I do?
Bookmarks