Results 1 to 2 of 2

Thread: std::string to QString

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default std::string to QString

    I am looking for the easiest way to convert a c++ standard string to a QString?

    I can only think of appending them (char ) one by one into QString but there must be an easy way ....

    baray98

  2. #2
    Join Date
    Sep 2007
    Location
    Rome, GA
    Posts
    199
    Thanks
    14
    Thanked 41 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: std::string to QString

    QString qstring(stdstring.c_str());

    or

    QString::fromStdString(stdstring);

    are easy.
    Last edited by JimDaniel; 19th July 2008 at 04:01.

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

    baray98 (19th July 2008)

Similar Threads

  1. Getting std::string object from QString object ( qt3)
    By joseph in forum Qt Programming
    Replies: 11
    Last Post: 28th March 2013, 20:09
  2. std::string to QString?
    By Backslash in forum Newbie
    Replies: 4
    Last Post: 1st August 2007, 15:50
  3. QString static callback function from CURL
    By tpf80 in forum Qt Programming
    Replies: 12
    Last Post: 16th May 2007, 20:47
  4. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 17:59
  5. Converting QString to unsigned char
    By salston in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 22:10

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.