×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    How to convert a QVariantList to QStringList ?

    Hi all,
    I am wondering if it's possible to convert a QVariantList to a QStringList

    thank you for any help.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to convert a QVariantList to QStringList ?

    It's possible, but only if QVariantList contains strings. Opposite is possible always.
    Last edited by divanov; 2011-06-22 at 15:16. Reason: fixing typo

  3. #3
    Regular Contributor
    Join Date
    Dec 2010
    Posts
    63

    Re: How to convert a QVariantList to QStringList ?

    ok thank you
    have u an example showing this ?

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: How to convert a QVariantList to QStringList ?

    Code:
    QList<QString> stringList;
    QList<QVariant> variantList;
    QListIterator<QVariant> i(variantList);
    while (i.hasNext()) {
      stringList << i.next().toString();
    }
    More enhanced conversion would include QVariant::canConvert.

Similar Threads

  1. How to extract a QString from a QStringList
    By sami.mahjoub in forum [Archived] Beginning Qt
    Replies: 3
    Last Post: 2011-02-09, 16:07
  2. QStringList performance issues due to size()
    By CatzHoek in forum [Archived] Qt SDKs and Tools
    Replies: 0
    Last Post: 2010-01-20, 19:57
  3. How to convert TInteger and RIntiger in to TBuf
    By aamitgupta in forum Symbian
    Replies: 1
    Last Post: 2009-12-05, 16:46
  4. How to convert the jpeg image data to CFbsBitmap
    By whitewinds in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2007-04-17, 08:00
  5. How to convert AMR and AWB ringtones to MIDI?
    By HornyBass in forum Symbian
    Replies: 4
    Last Post: 2004-05-18, 14:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×