[Development] Dropping the Q prefix from class names

Stephen Kelly stephen.kelly at kdab.com
Sun Apr 1 17:56:37 CEST 2012


On Sunday, April 01, 2012 15:04:34 joao.abecasis at nokia.com wrote:
> Hi all,
> 
> Earlier today I pushed some changes to Gerrit, Thiago suggested I bring
> it up on the mailing list before he can approve them. Given the impact
> these changes have on user code it's important that we get this merged
> to master and out in the alpha as quickly as possible.

Thank you. :)

I've been advocating for a change like this for a long time.

> 
> For reference the changes can be viewed here:
> 
>     http://codereview.qt-project.org/22063
>     http://codereview.qt-project.org/22064
> 
> The first one introduces a Q namespace, which replaces the Q prefix in
> Qt5. The second patch drops the prefix in class names. This brings the
> C++ API more in line with the QML/JavaScript one and will hopefully help
> move all remaining C++ developers to JavaScript.

Good way to achieve that imo.

> 
> Still pending are patches to:
> 
> - propagate the change to the various modules;
> - drop the q prefix from file names
> - update fixqt4headers script to automatically fix user code
> - rename the Q::Qt namespace to Q::t

Another advantage of this is that it will make it more difficult to use the 
same codebase with both Qt 4 and Qt 5. We keep on saying that after porting to 
Qt 5, you should never look back. 

Any technical measures we can take to discourage people from using Qt 4 
anymore are welcome in my book.

> 
> While we're at this, it would be good to improve our interoperability
> with C++11. I have another patch in the works that drops camelCase, in
> favor of the standardized names_with_underscores.

An additional benefit of this is that classes such as Qt::string will be named 
the same as std::string. That should make it easier for people to port from 
non-Qt C++ code to the Qt equivalent classes if they add a 'using namespace 
Qt' or so to their code.

> The extra separation
> between words will be welcomed by those of us that use small fonts and
> ALL-CAPS editors.

I don't use such an editor, so I don't know.

> Again, given the impact these changes will have, I urge everyone to
> pitch in, review and help bring this effort to good harbor.

I can help out, but only until the end of today I'm afraid.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120401/a3d3edff/attachment.html>
-------------- 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/20120401/a3d3edff/attachment.sig>


More information about the Development mailing list