Results 1 to 2 of 2

Thread: Creating QString from std::sstream

  1. #1

    Default Creating QString from std::sstream


    I have a problem convert stringstream to QString.
    I know that the QString operator << is not overloaded in
    i know also that i have to use the std::string for QString
    but i do not know how to do it exactly.
    Please help me solving this problem.
    i have update a code from qt3 to qt4.
    the following code works in qt3 but not in qt3.

    //Code that works in qt3:
    stringstream ss;
    ss << "FunctionCall" <<endl;
    QString QStr = ss.str();

    How can i update that code exactly to works with Qt4.
    Thank you too much for your help.
    Best Regards,

  2. #2
    Join Date
    Feb 2006
    Thanked 541 Times in 521 Posts
    Qt products
    Unix/X11 Windows

    Default Re: What is the fastest way to draw a circle ?

    The solution:
    Qt Code:
    1. stringstream ss;
    2. ss << "FunctionCall" <<endl;
    3. QString QStr = QString::fromStdString(ss.str());
    4. insertParagraph(QStr,0);
    To copy to clipboard, switch view to plain text mode 

    You really should have created a new thread. This is not the appropriate place to start your thread.


  3. The following user says thank you to marcel for this useful post:

    TheIndependentAquarius (18th December 2012)

Similar Threads

  1. QString static callback function from CURL
    By tpf80 in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 20:47
  2. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  3. Converting QString to unsigned char
    By salston in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 22:10
  4. Replies: 2
    Last Post: 10th February 2006, 12:57
  5. [SOLVED] Widget plugin ... how to ?
    By yellowmat in forum Newbie
    Replies: 10
    Last Post: 29th January 2006, 20:41


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.