[Development] templated QObjects [was: Re: We are planning to upgrade qdoc to use clang for parsing C++]
Jędrzej Nowacki
jedrzej.nowacki at theqtcompany.com
Fri Mar 4 14:18:00 CET 2016
On Monday 29 of February 2016 08:38:30 Thiago Macieira wrote:
> On segunda-feira, 29 de fevereiro de 2016 10:09:51 PST Jędrzej Nowacki
wrote:
> > On Friday 26 of February 2016 15:56:08 Thiago Macieira wrote:
> > > > I.e. what problems would we get from having to install the
> > > > moc files?
> > >
> > > Lots.
> >
> > And probably all go away if instead of installing anything we use
> > QMetaObjectBuilder (assuming it's api stabilization). Yes it would have
> > performance impact, but only on the templated version and only during
> > initialization, qml is paying that price constantly without bigger
> > complains. It would not require any build system changes. The only
> > limitation I can think of right now is that in QObject<Foo>, Foo needs to
> > be know to QMetaType system, which is not a big deal.
>
> What source data do you propose for QMOB?
So for QObject<Foo> moc should generate something like that:
{
QMetaObjectBuilder builder; // Side note: add overloads that takes type id
builder.addProperty("property", "int")
builder.addMethod("void Invokable(int)");
builder.setClassName("QObject<" + QMetaType::typeName(qMetaTypeId<Foo>())
+ ">")
return builder.toMetaObject();
}
Yes, it is super inefficient, but in the same time I think it is quite safe to
support.
Cheers,
Jędrek
More information about the Development
mailing list