Results 1 to 3 of 3

Thread: QString into QStringList

  1. #1
    Join Date
    Nov 2011
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QString into QStringList

    Hello,

    I'm trying to convert a QString into a QStringList using the split function, but i don't seem to get what's missing in this simple code :
    Qt Code:
    1. QString string = "a,b,c,d";
    2. QStringList stringList= string.split(",",QString::SkipEmptyParts);
    3.  
    4. for (int i = 0; i < stringList.size(); i++){
    5.  
    6. qDebug(stringList.at(i));
    7. }
    To copy to clipboard, switch view to plain text mode 
    i get the error : no matching function for call to ‘qDebug(const QString&)’

    any one got an idea !!.
    K|Z
    Last edited by Lykurg; 14th November 2011 at 21:26. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QString into QStringList

    Maybe there is no function qDebug(const QString&)...

    Use
    Qt Code:
    1. qDebug(stringList.at(i).toUtf8());
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. qDebug() << stringList.at(i);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QString into QStringList

    Or get rid of the for loop and do
    Qt Code:
    1. qDebug() << stringList;
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QStringlist To QString
    By phillip_Qt in forum Qt Programming
    Replies: 6
    Last Post: 19th June 2015, 14:17
  2. Replies: 3
    Last Post: 23rd March 2011, 22:39
  3. QString to QStringList
    By been_1990 in forum Newbie
    Replies: 8
    Last Post: 7th May 2010, 15:34
  4. QString, QStringList and garbage collection...
    By PaladinKnight in forum Newbie
    Replies: 4
    Last Post: 5th April 2010, 16:22
  5. QMAP<QString, QStringList>
    By bismitapadhy in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2010, 04:47

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.