[Development] templated QObjects [was: Re: We are planning to upgrade qdoc to use clang for parsing C++]

Thiago Macieira thiago.macieira at intel.com
Sat Feb 27 20:07:44 CET 2016


On sábado, 27 de fevereiro de 2016 12:56:11 PST Olivier Goffart wrote:
> > First of all, note that you're asking that
> >
> >  a) installing generated code
> >  b) including such generated code from your public headers
> 
> Not necessarily installed:
>  - The feature might be used only for application code or implementation 
> without having the need of installing them.
>  - The build system can be adapted such that moc is run on headers
> containing  object template from a library, and put these generated code in
> the build directory.

Ok, this is an interesting solution. I don't like it, but it's workable.

If you want to use template QObjects, you need to tell your buildsystem where 
the header files declaring such a QObject are (/usr/include/...) and which 
template expansion of it you want. Each one. Then moc gets run for creating 
the meta object for those classes, which will need to be Q_DECL_EXPORT'ed from 
your module.

If we do this, I recommend moc-ng, so that it can actually understand the 
templates and calculate the proper expansions for the reflection.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list