[Development] Consistency in Qt headers (extends: 'renaming all QWindow properties that have "window" in them')
Stephen Kelly
stephen.kelly at kdab.com
Fri Oct 26 19:10:15 CEST 2012
On Friday, October 26, 2012 23:34:32 Sze Howe Koh wrote:
> Hi all,
>
> The first proposed change has been submitted to Gerrit, to give QSql its
> own camel-case header: https://codereview.qt-project.org/38294
>
> Does anyone have any objections/suggestions for the rest of this plan? If
> not, I'll start working on the next part: Renaming some namespaces that
> were introduced in Qt 5 (QtLocation, QtMultimedia, QtMultimedia::Metadata)
>
> I remain convinced that the current names are unsuitable. Take the Qt
> Bluetooth module as the role model: "QtBluetooth" is its
> compact-module-name and module-header-name for the whole module. There is a
> "QtBluetooth" namespace, but that's internal (
> https://qt.gitorious.org/qt/qtconnectivity/blobs/master/src/bluetooth/qbluet
> oothglobal.h) -- the public namespace, and the public namespace-header, is
> "QBluetooth". Taking Qt Location in contrast, "QtLocation" currently fills
> the role of compact-module-name, module-header-name, AND
> public-namespace-name. This is a name clash, and it also leaves no
> (consistent) way to #include the namespace without pulling in the whole
> module.
>
I think this is a good initiative. See also
https://codereview.qt-project.org/#change,37727
which is a move in the opposite direction.
You wrote that QtBluetooth is an internal namespace, but it is not.
Notice also that namespaces are used inconsistently for classes, both in the
former Qt 5 and in the former QtMobility.
Here's an output of one of the public classes from each public Qt module:
stephen at hal:~/dev/src/qt5{master}$ git submodule foreach "git grep -h -e ';'
--and --not -e return -- tests/auto/cmake/test_modules/main.cpp || echo"
Entering 'qt3d'
QGLTexture2D gLTexture2D;
QQuickItem3D quickItem3D;
Entering 'qtactiveqt'
Entering 'qtbase'
QObject object;
QtConcurrent::BlockSizeManager blockSizeManager(42);
QHostAddress hostAddress;
QGLBuffer glBuffer;
QSqlQuery sqlQuery;
QSignalSpy signalSpy(&object, SIGNAL(destroyed()));
QWidget widget;
QDomDocument domDocument;
QPrintDialog printDialog;
QDBusMessage dBusMessage;
Entering 'qtconnectivity'
QtBluetooth::QBluetoothAddress bluetoothAddress;
Entering 'qtdeclarative'
QQmlEngine qmlEngine;
QQuickItem quickItem;
Entering 'qtdoc'
Entering 'qtfeedback'
QFeedbackHapticsEffect feedbackHapticsEffect;
Entering 'qtgraphicaleffects'
Entering 'qtimageformats'
Entering 'qtjsbackend'
Entering 'qtlocation'
QPlace place;
Entering 'qtmultimedia'
QCamera camera;
QVideoWidget videoWidget;
Entering 'qtpim'
QtContacts::QContact contact;
QtOrganizer::QOrganizerCollection organizerCollection;
Entering 'qtqa'
Entering 'qtquick1'
QDeclarativeEngine qdeclarativeEngine;
Entering 'qtrepotools'
Entering 'qtscript'
QScriptEngine scriptEngine;
QScriptEngineDebugger scriptEngineDebugger;
Entering 'qtsensors'
QLightSensor lightSensor;
Entering 'qtsvg'
QSvgWidget svgWidget;
Entering 'qtsystems'
QValueSpaceSubscriber valueSpaceSubscriber;
QServiceInterfaceDescriptor serviceInterfaceDescriptor;
QDisplayInfo displayInfo;
Entering 'qttools'
QFormBuilder formBuilder;
QHelpEngine helpIndexModel("dummy");
QUiLoader uiLoader;
Entering 'qttranslations'
Entering 'qtwayland'
Entering 'qtwebkit'
Entering 'qtwebkit-examples-and-demos'
Entering 'qtxmlpatterns'
QXmlQuery xmlQuery;
QtBluetooth uses a namespace for public APIs, but QtLocation does not, for
example.
The bluetooth classes also already have a Q prefix, so the namespace is
probably redundant. I'd like to see it removed. If what others want is a move
toward *more* namespaces, then I think the rest of the former QtMobility
should get them too (all the stuff that's new in Qt5).
I'm all for the consistent use of namespaces, but before you implement
everything, it probably makes sense to hear from others too.
Thanks,
--
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
** Qt Developer Conference: http://qtconference.kdab.com/ **
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121026/a1b3d84b/attachment.sig>
More information about the Development
mailing list