Hi there i've written a C code which prints the integer values 1 to 50 and i tried to change my progress bar dynamically by using QProcess. But the progress bar is not varying. If my c file has only one printf that prints any value for example 50, then the progress bar works, but whenever i try to loop some values i cannot get the variation in the progress bar. I just want to know how to do it using QProcess. Can anyone help me regarding this issue.....? Thank you.... Here's my code:
#include "progres.h"
#include <QProcess>
#include <QProgressBar>
{
progressbar->setGeometry(75,40,200,35);
progressbar->setRange(0,100);
proces
->setReadChannelMode
(QProcess::MergedChannels);
proces
->setReadChannel
(QProcess::StandardOutput);
connect(proces, SIGNAL(readyReadStandardOutput()),this, SLOT(disp()));
proces->start("./tstf");
}
void Progres :: disp()
{
int t;
t = proces->readAllStandardOutput().toInt();
progressbar->setValue(t);
}
#include "progres.h"
#include <QProcess>
#include <QProgressBar>
Progres ::Progres(QWidget *parent)
{
progressbar = new QProgressBar(this);
progressbar->setGeometry(75,40,200,35);
progressbar->setRange(0,100);
proces = new QProcess(this);
proces->setReadChannelMode(QProcess::MergedChannels);
proces->setReadChannel(QProcess::StandardOutput);
connect(proces, SIGNAL(readyReadStandardOutput()),this, SLOT(disp()));
proces->start("./tstf");
}
void Progres :: disp()
{
int t;
t = proces->readAllStandardOutput().toInt();
progressbar->setValue(t);
}
To copy to clipboard, switch view to plain text mode
Where "tstf" is a C obj file that i've copied in the dir of my Qt project.
Bookmarks