[Qt-interest] Use myClass* with QMetaProperty
Rohan McGovern
rmcgover at trolltech.com
Thu Dec 18 23:34:06 CET 2008
On Thursday 18 December 2008, Ender EREL wrote:
> Hi everybody,
Hi,
>
> The editor gets a QObject* (actually a B*) and creates widgets
> for other members. Then it tries to get the myA member using
> mObject->property("myA") but the returned Qvariant is invalid,
> and output shows this message:
>
> QMetaProperty::read: Unable to handle unregistered datatype 'A*'
> for property 'B::myA'
>
> I also tried using Q_DECLARE_METATYPE(A*) but it did not work
> either.
>
You need to _register_ the datatype, not just declare it. They are
not quite the same.
i.e., you need both Q_DECLARE_METATYPE and qRegisterMetatype.
http://doc.trolltech.com/4.5/qmetatype.html#qRegisterMetaType-2
--
Rohan McGovern
Qt Software, Nokia
More information about the Qt-interest-old
mailing list