[Qt5-feedback] The #include directives for Qt Essentials and Qt Add-on modules

Craig.Scott at csiro.au Craig.Scott at csiro.au
Mon Jul 4 00:02:27 CEST 2011


On 03/07/2011, at 6:00 PM, Andre Somers wrote:

> Hi,
> 
> Op 3-7-2011 1:22, Craig.Scott at csiro.au schreef:
>> On 01/07/2011, at 10:30 PM,<lars.knoll at nokia.com<mailto:lars.knoll at nokia.com>>  <lars.knoll at nokia.com<mailto:lars.knoll at nokia.com>>  wrote:
>> 
>> 
>> In there, it should IMO look something like:
>> 
>> QtCore/Qcore
>> QtCore/qlist.h
>> ...
>> QtGui/QtGui
>> QtGui/Qpainter
>> ...
>> QtAddons/MyAddon/MyAddon
>> QtAddons/MyAddon/myheader.h
>> QtAddons/AnotherAddon/...
>> 
>> 
>> I agree with the intent, but I do question the naming convention used for the header that pulls in all headers for a module. Duplicating the module name as the "include everything" header seems somewhat confusing. How about a more explicit convention where we append "All" to the name (or some other equivalent)? So the above would become (with corrections for what I think were typos in your QtCore and QPainter examples):
>> 
>> QtCore/QtCoreAll
>> QtCore/qlist.h
>> ...
>> QtGui/QtGuiAll
>> QtGui/QPainter
>> ...
>> QtAddons/MyAddon/MyAddonAll
>> QtAddons/MyAddon/myheader.h
>> QtAddons/AnotherAddon/...
>> 
>> 
>> I think the "QtCoreAll" convention would be much clearer to devs what is being included. Having QtCore/QtCore just looks odd to me.
> I like the "All", but why prepend the module name again then? This looks 
> quite clear to me:
> 
> QtGui/All
> QtCore/All
> QtAddons/MyAddon/All
> 


You need to keep the module name to support those people who want behaviour like it is now, ie omit the directory part and instead add the directory to the include search path. They would end up with something like this:

#include "QtCoreAll"
#include "QtGuiAll"
#include "MyAddon"

If the "pull everything in" header did not include the module name, all the headers would simply be called "All" and that would thwart the above approach. Whether that approach should still be supported is, I guess, a separate question, but it would seem worth at least giving people the option if they really want it. Also, it is generally a good idea to make the header name give at least some indication of what it pulls in, and I fear that "All" would simply be too generic.

--
Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia





More information about the Qt5-feedback mailing list