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

BRM bm_witness at yahoo.com
Fri Jul 1 10:28:15 CEST 2011


----- Original Message ----

> From: "henry.haverinen at nokia.com" <henry.haverinen at nokia.com>
> To: charleyb123 at gmail.com; shane.kearns at accenture.com
> Cc: qt5-feedback at qt.nokia.com
> Sent: Fri, July 1, 2011 4:04:29 AM
> Subject: Re: [Qt5-feedback] The #include directives for Qt Essentials and Qt 
>Add-on modules
> 
> > Henry spaketh:
> > I had a brief chat with Lars, and based on that I  updated a proposal to
> > the product definition wiki:
> >  
>http://developer.qt.nokia.com/groups/qt_contributors_summit/wiki/Qt5ProductDefinition
>
> >
>  
> >  Shane respondeth: 
> > What about #include for a single class, rather than  the whole module?
> > 
> > For essentials, I assume that you would still  use:
> > #include <QString>
> 
> Right, that's my assumption  too.
> 
> Charley wrote:
> 
> > Our "#include<>" conventions, and  class name clashes (across add-ons)
> > *are* a problem for trade-offs.   However, I read our "#include<>" plans on 
> > the  Qt5ProductDefinition page, and am very concerned:
> 
> > // ARE YOU SURE  YOU WANT TO DO THIS?
> > #include  <some/path/SomeFile.hpp>
> 
> We're certainly not sure we want to do  that :-)
> 
> It was based on a 2-minute discussion, and we just wanted to  have a proposal 
> for discussion. The reason for proposing to use  subdirectories was to be 
>consistent with 
>
> the QML import statements and the  C++ namespace. 
> 
> So thanks for your insights! I don't think that reason is  good enough 
> to justify the problems you listed.
> 
> > For these  plugins, I really think there is very low likelihood of
> > name collisions  across packages:
> >
> > #include <Foo>  // for  QtAddOn/Foo
> > 
> > ...But, if we wanted explicit namespaces, I'd  prefer:
> > 
> > #include <QtAddOn.Foo>
> 
> I think it's  important to be explicit, and as consistent between QML and C++ 
>as 
>
> possible.  I went ahead and updated the wiki according your latter proposal. 
> 
> Shane  wrote about the include directive for classes of add-ons:
> 
> > For  add-ons, the clean looking option:
> > #include  <QtAddOn/Foo/Bar>
> > has the problem that <QtAddOn/Foo>, the  file, clashes with the 
subdirectory.
> >
> > #include  <Bar>
> > is no good because of potential class name clashes
> 
> So  in the light of #include <QtAddOn.Foo> and Charley's arguments about 
> the harmfulness of using subdirectories, does anyone have good suggestions 
> for including the classes of add-ons?
> 
> #include  <QtAddOn.Foo.Bar> // this may look a bit weird but it would be  
>logical...
> 

As noted elsewhere in this thread, the issue raised is very likely a non-issue.
I do recommend the #include <QtAddon/Foo> and #include <QtAddon/Foo.xxx> usage.
Not only would it bring consistency within Qt - as you note - but it would also 
bring consistency with other larger projects and libraries.

Ben



More information about the Qt5-feedback mailing list