On Thursday 18 June 2015 15:45:06 Matthew Woehlke wrote: > On 2015-06-18 09:07, Marc Mutz wrote: > > 4. Includes: > > a. <QtFoo> includes the whole module (as is the case for QtCore, ... > > now) b. There's no <QtLike> include for just the namespace (with > > enums, free > > > > functions, etc). To get the namespace, users include any class from > > the module (much like no-one is using <QtGlobal> atm, but relies > > on any <QFoo> to include it indirectly). > > Are you sure? I've used <QtGlobal> a good handful of times. In general I > find it helpful to be able to include just the types / macros / free > functions without dragging in some random class that I don't actually > care about. > > Reasons I have used <QtGlobal>: > > - I want only the macros > - I want only the platform / compiler feature symbols > - I want only some free function (e.g. qRound) > - I want only the convenience typedefs (e.g. qint64, qreal) > > So I definitely would not say that there is no use for having a header > with a module's global entities separate from the per-class headers. > > In fact, I'm annoyed that <QtNumeric> is missing... IMHO if it's a > public header, it should have a <CamelCaseName> wrapper. (Well, *was* > missing; it was added in Qt5, thankfully!)
I believe people with so narrow use-cases can be bothered to include <QtCore/qglobal.h>. IIRC, the alternative proposal was to let people include the whole module (<QtCore>) to get the namespace (reliably, without depending on indirect includes). FWIW, your usual Qt module doesn't define lots of free functions and macros that you'd be interested in. If you step back a bit, you'll notice that both <QtGlobal> and <QtNumeric>, as well as <QtNamespace> are big, fat, mistakes. QtGlobal doesn't include all of the Qt Global module, etc. They just confuse users by appearing in QtC header autocompletion. Thanks, Marc -- Marc Mutz <[email protected]> | Senior Software Engineer KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company Tel: +49-30-521325470 KDAB - The Qt Experts _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
