Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: Convert a QByteArray to a QVariantList

  1. #21
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Convert a QByteArray to a QVariantList

    Quote Originally Posted by SixDegrees View Post
    Qt isn't syntactically different in C#; it is written and works exactly the same way as it does anywhere else.

    It isn't the language that's at fault.
    OK so let me know why this code doesn't work:

    Qt Code:
    1. //fp data
    2. QByteArray b = user->fingerData(); //<-- return a reference to a QByteArray containing the fingerprint data
    3.  
    4. QVariant v(b);
    5. QVariantList fingerData;
    6.  
    7. fingerData.append(v);
    To copy to clipboard, switch view to plain text mode 

    I need to convert QByteArray b to QVariantList fingerData.
    I'm sure I'm doing some mistake but I don't know which one. Instead in C# I don't have to convert anything.
    I prefere C++ to C# but I can not loose 1 week to discover how to do a conversion.

    Regards
    Franco Amato

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Convert a QByteArray to a QVariantList

    What do you mean by "it doesn't work"? It doesn't compile, it crashes when ran?

    Instead in C# I don't have to convert anything.
    If you were using Qt bindings in C# to access the COM server you'd have to do the exact same conversion. Don't blame the language, as somebody already said. You are using Qt wrapper over C++ (or probably even C) interface to (D)COM. If you have trouble using Qt structures with COM, maybe you should make a bare C/C++ WinAPI call to the COM server. You will probably get some wacky structure in return but maybe this structure will be documented by MSDN good enough for you to understand how to use it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. how to convert an int to QByteArray
    By babu198649 in forum Qt Programming
    Replies: 12
    Last Post: 19th September 2014, 09:47
  2. Convert QPixmap to QByteArray ?
    By probine in forum Qt Programming
    Replies: 5
    Last Post: 13th March 2014, 08:23
  3. convert QString to QByteArray
    By morgana in forum Qt Programming
    Replies: 5
    Last Post: 2nd March 2011, 13:33
  4. how can we convert QByteArray to Qstring?
    By learning_qt in forum Qt Programming
    Replies: 2
    Last Post: 21st July 2009, 14:05
  5. Convert from QByteArray to String ?
    By probine in forum Newbie
    Replies: 3
    Last Post: 25th March 2006, 15:49

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
  •  
Qt is a trademark of The Qt Company.