Results 1 to 7 of 7

Thread: QByteArray to Qstring

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2011
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QByteArray to Qstring

    Have a QProcess which gets a command output from my Ubuntu system. I have a pushbutton which executes this QProcess and does the work perfectly and i see the output in Application Window.. But i have a Text Edit in front of this Pushbutton where i need the output of Qprocess to be pasted. But this is not happening. I am doing a ReadallStandard Output which converts to QByteArray form. I guess this is the problem as its not being converted to string format.How do i get the QbyteArray to String format???
    Here is the code i am using.Let me know what is wrong.
    Qt Code:
    1. QByteArray result = proc.readAllStandardOutput();
    2. QString command(result);
    3. result=command.toAscii();
    4. QPushButton *KernelName= new QPushButton();
    5. ui->textEdit->setText(command);
    6. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Lykurg; 16th November 2011 at 14:55. Reason: missing [code] tags

Similar Threads

  1. Problem with QString and QByteArray
    By ts66 in forum Newbie
    Replies: 2
    Last Post: 10th May 2011, 22:30
  2. convert QString to QByteArray
    By morgana in forum Qt Programming
    Replies: 5
    Last Post: 2nd March 2011, 14:33
  3. QByteArray to QString
    By hvitual in forum Qt Programming
    Replies: 3
    Last Post: 12th December 2009, 11:43
  4. QByteArray to QString
    By babu198649 in forum Newbie
    Replies: 7
    Last Post: 6th December 2007, 14:08
  5. How to get QByteArray from QString in Qt3
    By joseph in forum Qt Programming
    Replies: 2
    Last Post: 5th September 2007, 10:23

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
  •  
Qt is a trademark of The Qt Company.