how to redirect system output to my gui app (qt, linux)? -
i need develop gui program wich run external bash script. script working 30-40 minutes , want see system output in application in real time. how can provide this? should use qtextstream? please give me examples. thanks.
if launch script via qprocess, can output connecting readyread signal. it's matter of calling of read functions data , displaying on type of widget want, such qtextedit has append function adding text.
something this: -
// assuming qtextedit textedit has been created , in class // slot called updatetext() qprocess* proc = new qprocess; connect(proc, signal(readyread()), this, slot(updatetext())); proc->start("pathtoscript"); ... // updatetext in class stored pointer qprocess, proc void classname::updatetext() { qstring appendtext(proc->readall()); textedit.append(appendtext); }
now, every time script produces text, updatetext function called , adding qtextedit object.
Comments
Post a Comment