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

Bo Thorsen bo at vikingsoft.eu
Mon Feb 29 09:44:29 CET 2016


Den 27-02-2016 kl. 20:07 skrev Thiago Macieira:
> 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.

Well, you could give the include path to moc and let it search? If the 
compiler can find the proper file, moc can too.

In qmake it would be possible to add something like

EXTERNAL_TEMPLATE_HEADERS += foobar.h

And magic stuff happens...

It sounds like this is something that would require qmake, moc and qdoc 
support, not just moc-ng.

Bo Thorsen,
Director, Viking Software.

-- 
Viking Software
Qt and C++ developers for hire
http://www.vikingsoft.eu



More information about the Development mailing list