Results 1 to 2 of 2

Thread: QSet<QVariant> is supported ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Bengaluru
    Posts
    144
    Thanks
    8
    Thanked 7 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QSet<QVariant> is supported ?

    Qt Code:
    1. QList<QVariant> list;
    2. QSet<QVariant> varSet;
    3. varSet = list.toSet();
    To copy to clipboard, switch view to plain text mode 

    Is this not possible? Am getting error If i do so saying this overload is not supported.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSet<QVariant> is supported ?

    QSet is based on QHash. QHash doesn't know how to hash a QVariant. You'll have to find a different solution for what you want, or if the variants are all of the same type, convert them to the type and make a set out of that.

    Aside from that you could tell QHash how to hash a QVariant, by providing a qHash() function for QVariants.
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. QSet and custom class
    By been_1990 in forum Qt Programming
    Replies: 12
    Last Post: 22nd January 2010, 16:36
  2. Replies: 1
    Last Post: 4th December 2009, 17:03
  3. QT4 - QT SOAP supported?
    By talk2amulya in forum Qt Programming
    Replies: 2
    Last Post: 11th February 2009, 09:15
  4. QFont - supported fonts
    By prak in forum Qt Programming
    Replies: 1
    Last Post: 28th July 2008, 21:25
  5. Does OpenGL be supported in opensource of Qt-4.1.2?
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2006, 10:46

Tags for this Thread

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.