Results 1 to 2 of 2

Thread: How to add metatype support for QMap<int,QVariant>?

  1. #1
    Join Date
    Feb 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How to add metatype support for QMap<int,QVariant>?

    is it possible and how?

    My wish is is to use it as Q_PROPERTY. For it I would need QVariant support and metatype is needed for it.

    regards, Harri

  2. #2
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to add metatype support for QMap<int,QVariant>?

    You need to use the macro Q_DECLARE_METATYPE() and call qRegisterMetaType().
    You are probably running in to troubles because your types name contains a comma and that doesn't work well with macros. You can fix that with something like:
    Qt Code:
    1. typedef QMap<int,QVariant> MyType;
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 4th December 2009, 17:03
  2. QMap
    By sophister in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2009, 10:05
  3. Qmap
    By phillip_Qt in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2007, 10:43
  4. Reg - QMap(Qt3.3.4)
    By suresh in forum Newbie
    Replies: 3
    Last Post: 18th October 2006, 22:04
  5. QVariant types support for custom properties
    By Dusdan in forum Qt Tools
    Replies: 9
    Last Post: 11th January 2006, 09:55

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