Results 1 to 2 of 2

Thread: QVariant to QString (binary)

  1. #1
    Join Date
    Oct 2012
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QVariant to QString (binary)

    Hello guys,

    i have in hands a basic problem.


    Variable attributeValue is QVariant.

    QByteArray value;
    for(int i=0;i<(int)attribute.ulValueLen;i++)
    value.append(((quint8*)attribute.pValue)[i]);
    attributeValue.setValue(value);

    After this code i want put in one std::string the attributeValue.

    QByteArray is a binary?

    Thanks.

    Regards,

    8080205

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QVariant to QString (binary)

    Ok just put QString in QVariant, what is stopping you? I mean what is the problem in doing so?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. QString to Binary Problem
    By onder_11 in forum Qt Programming
    Replies: 5
    Last Post: 22nd October 2012, 02:43
  2. QVariant with QString / who free's its data?
    By elias.bachaalany in forum Newbie
    Replies: 1
    Last Post: 26th October 2010, 10:42
  3. How can I read binary data to QString?
    By zolookas in forum Newbie
    Replies: 2
    Last Post: 29th July 2008, 20:03
  4. QDataStream and QHash<QString,QVariant> crash on read
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 15th July 2008, 12:14
  5. Replies: 1
    Last Post: 2nd April 2007, 22:52

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.