Results 1 to 20 of 22

Thread: Convert a QByteArray to a QVariantList

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    This code doesn't convert a byte array to a variant list. It simply adds the byte array to a variant list in a very complicated way.
    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.


  2. #2
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    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 wysota View Post
    This code doesn't convert a byte array to a variant list. It simply adds the byte array to a variant list in a very complicated way.
    Wysota so how must I do? help me please
    Franco Amato

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    I don't know what you have to do. I don't know what the byte array contains. I'm merely stating the fact that you are not converting anything, just adding it to a list.
    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.


  4. #4
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    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 wysota View Post
    I don't know what you have to do. I don't know what the byte array contains. I'm merely stating the fact that you are not converting anything, just adding it to a list.
    Wysota the bytearray contains the fingerprint data.I stored the fingerdata in a QByteArray.
    The routine that I call with dinamicCall wants as second argument ( argument 1 as you told ) a QVariantList fingerData so I suppose that I have to convert from QByteArray to QVariantList to pass such variantlist to the routine that I call with dinamicCall.

    I'm unable to perform such conversion so I hope you can help me doing it.

    Kind Regards
    Franco Amato

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    I can't help you because I don't know what the call expects. Contact the authors of the DLL and ask them. Nobody here will be able to guess what the contents of the list should be just by looking at the function name.
    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.


  6. #6
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    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 wysota View Post
    I can't help you because I don't know what the call expects. Contact the authors of the DLL and ask them. Nobody here will be able to guess what the contents of the list should be just by looking at the function name.
    I already contacted the author and it gave to me a doc containing the routines list.
    The routine I have to call is named
    RegUserData
    .

    I list here the parameters wanted by such routine:
    CardID(string/10)
    OverWrite(0: no overwrite. If ID is already registered, return with result 06.,1: overwrite.)
    idxDesignation
    idxDepartment
    FirstName(string /15)
    LastName(string /15)
    idxGroup (integer/0~255)
    Status(1: Activate, 0: Deactivate)
    WorkMode(0:finger+pass ,1:finger,2ass,3:finger or pass,4:Only Crad,5:Only from external Reader,6:Matching on Mifare card)
    WorkTimeStart()
    WorkTimeEnd()
    EmployeeID
    RegisterMode( Finger =1, Password = 2, Finger and Password = 3, Card=4, Max=4)
    CheckExpire
    ExpireDateStart
    ExpireDateEnd
    Password(string/10)
    NF(Number of fingerprint data per user Max. 2)
    TemplateSize
    FingerData (byte,User Fingerprint data total size depends on the number of fingerprints registered per user)
    The param that give problems to me is the last: FingerData, that should be an array of bytes nothing more.
    When I generated the documentation with dumpcpp it says that I have to pass FingerData as QVariantList and here is where I would have your help.

    Thanx in advance.
    Franco Amato

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

    Default Re: Convert a QByteArray to a QVariantList

    This is the output of generateDocumentation:

    Qt Code:
    1. bool RegUserData(QString CardID, QVariantList FingerData, bool OverWrite = 0, int idxDesignation = 0, int idxDepartment = 0, QString FirstName = 0, QString LastName = 0, int idxGroup = 0, bool Status = 0, int WorkMode = 0, QString WorkTimeStart = 0, QString WorkTimeEnd = 0, QString EmployeeID = 0, int RegisterMode = 0, bool CheckExpire = 0, QDateTime ExpireDateStart = 0, QDateTime ExpireDateEnd = 0, QString Password = 0, int NF = 0, int TemplateSize = 0);
    To copy to clipboard, switch view to plain text mode 

    You can see that it ask for FingerData as second param and of type QVariantList.
    Franco Amato

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

    Thumbs down Re: Convert a QByteArray to a QVariantList

    Well I think Qt can not solve this problem.
    I have to implement it in C#
    Franco Amato

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    Quote Originally Posted by franco.amato View Post
    Well I think Qt can not solve this problem.
    I'm sure it can, you just can't blindly do different things hoping that one thing you try might be the correct one. You need to read some documentation, maybe browse and analyze some code and develop a solution to your problem. You won't be given an answer on a silver platter.

    I would guess (but only guess) the argument in question awaits a list of byte arrays where each byte array corresponds to a single fingerprint data. But again, that's just a guess based on some logical deduction.
    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.


  10. #10
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    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 wysota View Post
    I'm sure it can, you just can't blindly do different things hoping that one thing you try might be the correct one. You need to read some documentation, maybe browse and analyze some code and develop a solution to your problem. You won't be given an answer on a silver platter.

    I would guess (but only guess) the argument in question awaits a list of byte arrays where each byte array corresponds to a single fingerprint data. But again, that's just a guess based on some logical deduction.
    Wysota I don't want a solution on a silver plate. I only would convert a QByteArray to a QVariantList because I'm not able to do it. I tried many ways without success.
    And yes the the argument in question awaits a list of byte arrays where each byte array corresponds to a single fingerprint data. This device store a fingerprint with 352 bytes so my QByteArray has 352 elements and I would convert this 352 elements of my QByteArray to a QVariantList.

    Best
    Franco Amato

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 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

    Quote Originally Posted by franco.amato View Post
    Wysota I don't want a solution on a silver plate. I only would convert a QByteArray to a QVariantList because I'm not able to do it. I tried many ways without success.
    Because you first have to know what result you want to achieve before "trying many ways".

    And yes the the argument in question awaits a list of byte arrays where each byte array corresponds to a single fingerprint data.
    And how do you know that? Maybe it expects the number of byte arrays in the first cell of the list?
    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.


  12. #12
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    693
    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 wysota View Post
    Because you first have to know what result you want to achieve before "trying many ways".


    And how do you know that? Maybe it expects the number of byte arrays in the first cell of the list?
    No, the number of byte arrays is in another cell called template size that's 352
    NF(Number of fingerprint data per user Max. 2) //number of fingerprint per user ( maximum 2 )
    TemplateSize //352
    FingerData (byte,User Fingerprint data total size depends on the number of fingerprints registered per user) = templatesize * NF
    Franco Amato

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.