[Qt-interest] problem with qprocess and qprogressdialog
mierdatutis mi
mmm286 at gmail.com
Thu Jul 23 00:37:12 CEST 2009
Hi,
I launch a script with qprocess that execute some commands to concatenate
some large files.
I 'm trying to do a progress-bar to see the evolution.
Well, everything it's ok but when the progress bar goes in 20% I see that
the script doesn't works and the script stops it but I don't have any error.
My code is:
...........
........
setupUi(this);
proc2 = new QProcess( this );
progress = new QProgressDialog( "Operation in progress.", "Cancel", 0, 100
);
progress->setWindowModality(Qt::WindowModal);
progress->setRange(0,100);
progress->setValue(0);
progress->hide();
proc2->start("/home/david/pruebas/grabadas/kk.sh", QStringList() );
connect(proc2, SIGNAL(readyReadStandardOutput()),this, SLOT(salida()));
void MainWindowImpl::salida()
{
QStringList strs;
QDir directory("/home/david/pruebas/grabadas");
directory.setNameFilters(QStringList() << "*.TS");
directory.count();
qDebug() << " NO HEMOS ENTRADO";
qDebug() << "cuena es ..." << directory.count();
int total=directory.count();
char total2=directory.count();
qDebug() << total;
QByteArray result=proc2->readAllStandardOutput();
progress->show();
qDebug() << proc2->readAllStandardOutput();
QStringList lines = QString(result).split("\n");
foreach (QString line, lines) {
qDebug() << "El valor de line es..." << line;
if ( line.compare("1",Qt::CaseInsensitive)) {
qDebug() << " NO HEMOS ENTRADO";
}
else {
qDebug() << "ENTRADO";
progress->show();
progress->setValue(10);
progress->setFocus();
}
if ( line.compare("2",Qt::CaseInsensitive)) {
qDebug() << " NO HEMOS ENTRADO";
}
else {
qDebug() << "ENTRADO";
//progress->show();
progress->setValue(20);
}
if ( line.compare("3",Qt::CaseInsensitive)) {
qDebug() << " NO HEMOS ENTRADO";
}
else {
qDebug() << "ENTRADO";
progress->show();
progress->setValue(30);
progress->setFocus();
}
if ( line.compare("4",Qt::CaseInsensitive)) {
qDebug() << " NO HEMOS ENTRADO";
}
else {
qDebug() << "ENTRADO";
progress->show();
progress->setValue(40);
progress->setFocus();
}
if ( line.compare("5",Qt::CaseInsensitive)) {
qDebug() << " NO HEMOS ENTRADO";
}
else {
qDebug() << "ENTRADO";
progress->show();
progress->setValue(50);
progress->setFocus();
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090723/96676fe6/attachment.html
More information about the Qt-interest-old
mailing list