Results 1 to 2 of 2

Thread: QProcess::readAllStandardOutput and QTextEdit

  1. #1
    Join Date
    Jul 2012
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess::readAllStandardOutput and QTextEdit

    Hello everyone. Made a small gui for free console av scanner for personal use. Used QProcess::readAllStandardOutput to read command lines. But it's too much information in output in QString output; (like information about scanner, it's commands etc). I just want to see what it's currently scanning and what has found. Below is is some code from my program. QProcess ps, QString output, QString param (gave some parameters with gui). How can i get rid of not usefull information? Set some sort of filter or delete/replace from QString?

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindowClass) {
    3. ui->setupUi(this);
    4. ......
    5. connect(&ps, SIGNAL(readyRead()), this, SLOT(on_cmdExec_data_available()));
    6. }
    7.  
    8. void MainWindow::on_scanButton_clicked() {
    9.  
    10. output = "";
    11. ps.start(param);
    12. QTextCursor c = ui->textEdit_output->textCursor();
    13. c.movePosition(QTextCursor::End);
    14. ui->textEdit_output->setTextCursor(c);
    15. ui->textEdit_output->ensureCursorVisible();
    16. }
    17.  
    18. void MainWindow::on_cmdExec_data_available() {
    19. output += ps.readAllStandardOutput();
    20. ui->textEdit_output->append(output);
    21. }
    22. }
    23.  
    24. void MainWindow::on_stopButton_clicked() {
    25. ps.kill();
    26. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2012
    Posts
    14
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess::readAllStandardOutput and QTextEdit

    The output from QProcess::readAllStandardOutput is QByteArray. How to set filter on what i am addind from QByteArray to QString?

Similar Threads

  1. QProcess, readyRead, QTextEdit
    By sgrant327 in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2011, 16:49
  2. Replies: 0
    Last Post: 26th August 2010, 10:44
  3. QProcess and Qtextedit problem
    By skumar434 in forum Qt Programming
    Replies: 1
    Last Post: 17th March 2009, 18:24
  4. QProcess inside QProcess
    By bunjee in forum Qt Programming
    Replies: 7
    Last Post: 4th December 2008, 00:39
  5. Replies: 1
    Last Post: 16th February 2007, 07:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.