View Full Version : How to add metatype support for QMap<int,QVariant>?
makinenh
24th February 2010, 13:22
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
spud
24th February 2010, 16:15
You need to use the macro Q_DECLARE_METATYPE() (http://doc.trolltech.com/4.6/qmetatype.html#Q_DECLARE_METATYPE) and call qRegisterMetaType() (http://doc.trolltech.com/4.6/qmetatype.html#qRegisterMetaType-2).
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:
typedef QMap<int,QVariant> MyType;
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.