Doesn't it offend your sense neatness to use QVariant in the fiirst place? Especially that if you intend to use QVariant as the key, it will lead to spaghetti code when trying to determine the type of the key.
[And for any future googlers of this thread, I'm still confused as to the proper declaration/usage of Q_PROPERTY with QMap/QHash, sorry.]
I already told you how to do it.
typedef QMap<QString, int> StringIntMap;
Q_OBJECT
Q_PROPERTY(StringIntMap name READ name WRITE setName)
//...
};
typedef QMap<QString, int> StringIntMap;
class X : public QObject {
Q_OBJECT
Q_PROPERTY(StringIntMap name READ name WRITE setName)
//...
};
To copy to clipboard, switch view to plain text mode
Bookmarks