[Qt-qml] Dummy model for QList<QObject*> model

Cornelius Hald hald at icandy.de
Mon Sep 13 19:06:27 CEST 2010


----- Ursprüngliche Mitteilung -----
> Hi Cornelius,
> 
> On 13. sep. 2010, at 14.55, ext Cornelius Hald wrote:
> 
> > On Mon, 2010-09-13 at 13:38 +0200, Cornelius Hald wrote:
> > > Do I have to use Q_DECLARE_METATYPE() with MyListModel? I'll give it
> > > a, but I would be very grateful for additional hints.
> > 
> > After adding Q_DECLARE_METATYPE(MyListModel*); to the bottom of
> > MyListModel.h and qReisterMetaType<MyListModel*>("MyListModel"); to
> > main.cpp, the error message is gone.
> > Unfortunately all roles of my model are now [undefined].
> > 
> > Anything else I can try?
> 
> You probably need to define your role names;

Thanks, but the role names are set. As I said, if I directly expose the model object everthing works fine. The trouble starts if I expose an object that provides the model object as property.

Maybe this is not the recommended approach?

Cheers,
Conny




More information about the Qt-qml mailing list