[Development] Some Qt3D feedback
Marc Mutz
marc.mutz at kdab.com
Thu Jun 18 15:07:40 CEST 2015
On Thursday 18 June 2015 12:51:01 Smith Martin wrote:
> Do you also advocate rules for using namespaces in Qt? What rules does KDE
> use?
I believe it's worth reading Sze Howe Koh's mails in this thread and the last
one (Oct 2013), even if the mails tend to be overwhelmingly full of
information :)
On a completely personal note, I'd find the following most natural:
1. Each Qt Module "Qt Foo" (name used in docs), with soname
Qt<MajorVersion>Foo, only exports symbols in namespace QtFoo,
potentially with nested inline namespace V<MajorVersion>.
2. Free functions are not prefixed with 'q' (QtFoo::escape(), not
QtFoo::qEscape()).
3. Classes, I'm not so sure about the Q. Could leave it for better SC /
branding, or only add a deprecated typedef Bar QBar (either insider the
namespace or outside) for easier porting.
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).
c. Class includes: <QtFoo/QClass> or /Class, depending on (3). Maybe
<QClass> for backwards-compatibility, with a warning a la <strstream> on
GCC.
5. (most important) don't express a bias for QtFoo::Class vs. using directives
in the docs. That's _entirely_ up to the user. I'd even go so far as to
leave that up to the individual developer in Qt implementations, while
still demanding to following the style found in the file-under-edit, of
course. In docs and examples, I'd tend to use fully-qualified names, if
only for automatic qdoc linking, but if qdoc can cope (doxgen can), I'd use
using directives in the examples/ subdir, at least.
Thanks,
Marc
--
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
More information about the Development
mailing list