[Development] Dropping the Q prefix from class names

15 views
Skip to first unread message

joao.a...@nokia.com

unread,
Apr 1, 2012, 11:04:34 AM4/1/12
to devel...@qt-project.org
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.

For reference the changes can be viewed here:


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.

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

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. The extra separation
between words will be welcomed by those of us that use small fonts and
ALL-CAPS editors.

We'll need a script to fix user code. Ideally, user classes and APIs
also get ported to the new style. (I hear there's ongoing work for a
refactoring tool in Creator, which should land Real Soon Now (tm))

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

Qt 5 is going to be revolutionary.

Cheers,


João

PS - Help with testing alpha packages is also welcome ;-)

Sivan Greenberg

unread,
Apr 1, 2012, 11:22:29 AM4/1/12
to joao.a...@nokia.com, devel...@qt-project.org
Hey Joao,

On Sun, Apr 1, 2012 at 6:04 PM, <joao.a...@nokia.com> wrote:
> 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.
>

Do we really want to force all devs to move to JavaScript? From the
feedback I'm seeing around the community and companies that do
professional Qt development (Nokia included ;)) C++ is still the
serious way to do thing, while QML is for the UI and UX.

If We're already in the state where Qt's C++ interface can be replaced
with the QML one, then this makes a lot of sense. If this is not the
situation, then I suggest to have a transition period where which both
the namespace and the Q* in class name are still supported.

I imagine there are quite some Qt users who'd like to leverage the
performance improvements in Qt5, without having to rewrite every
single piece of code in QML. I also understand that startup times for
QML are somewhat long, even through that has been improved.

> 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
>

what does the 't' in Q::t stands for? And right, this is an intrusive
change that could bring a lot of rebuilding to existing software as
per your list of pending patches ;) Even if fixqt4headers fixes
everything automatically as per this change. Does it? :-)


> 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. The extra separation
> between words will be welcomed by those of us that use small fonts and
> ALL-CAPS editors.

Agreed! What can we do to automate legacy code support in this regard as well?

>
> We'll need a script to fix user code. Ideally, user classes and APIs
> also get ported to the new style. (I hear there's ongoing work for a
> refactoring tool in Creator, which should land Real Soon Now (tm))
>

Ah, nice does this answer my previous question?

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

Qt has already been revolutionary! But I wonder how far QML is from
having similar startup times to C++ Qt, and when everything you can do
from C++ will be possible from within QML.

> Cheers,
>
>
> João
>
> PS - Help with testing alpha packages is also welcome ;-)
>

If I manage to find the time (is always a short) I'll try to give it
some testing as well. /me wonders if it can be tested using Neccesitas
already.


Thank you for the hard work, I salute you the Qt team. The rate of
improvements and changes in the last couple of months have been
revolutionary by its own regard.

-Sivan
_______________________________________________
Development mailing list
Devel...@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Giuseppe D'Angelo

unread,
Apr 1, 2012, 11:49:07 AM4/1/12
to joao.a...@nokia.com, devel...@qt-project.org
2012/4/1 <joao.a...@nokia.com>:

> 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.
>
> 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.

I like it, but... sorry, you're after the feature freeze.
This is Qt 6.0 material.

Please resubmit in a couple of months, after 5.0 is branched off and
master starts targeting 6.0 (cf. the earlier discussion on marketing@,
Qt is adopting the major-version-increment scheme).

--
Giuseppe D'Angelo

Stephen Kelly

unread,
Apr 1, 2012, 11:56:37 AM4/1/12
to devel...@qt-project.org

On Sunday, April 01, 2012 15:04:34 joao.a...@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 <stephe...@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

signature.asc

Boudewijn Rempt

unread,
Apr 1, 2012, 12:45:15 PM4/1/12
to devel...@qt-project.org

This is insane. Effing, batshit insane. You propose to force people to adapt billions of lines of code because your editor is broken? There's not a single good reason for any of this, not an atom of it.

When Lars presented Qt5 at the devdays he was proud about how little effort it had taken to compile Qt Creator against Qt5. That's the way it should be. Have you got any idea of the amount of Qt4 code there is in the real world? Do you really think your script will fix all of that to conform to your tastes? It didn't work for Qt3 to Qt4.

I've got an application that's over ten years old. It's got over a million lines of Qt code. I was hoping it could continue going strong for ten, twenty years to come. It's a _real_ application.

I don't want a revolution, I don't want a revolutionary Qt4. I don't want an absolutely effing disaster like porting from Qt3 to Qt4 was -- a disaster that has taken some code bases, like Scribus, until _2011_ to recover from -- and you propose to mess with _everybodies_ code, just to get some extra double colons and underscores?

There's only one reason for Qt to exist and that is other people's code. Don't mess with that, especially not for merely cosmetic reasons.

I don't want to have to change ten year old coding style habits -- I want to improve my application, fix bugs, add features and keep my users happy for the next ten years.

I hope Guiseppe is right and that you're too late and I hope that Qt6 is at least ten years in the future.
--
Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl

Boudewijn Rempt

unread,
Apr 1, 2012, 12:51:59 PM4/1/12
to devel...@qt-project.org
On Sunday 01 April 2012 Apr, Sivan Greenberg wrote:
> On Sun, Apr 1, 2012 at 6:04 PM, <joao.a...@nokia.com> wrote:
> > 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.
> >
> Do we really want to force all devs to move to JavaScript?

One of the most ghastly problems there are with using QML and javascript right now is there's absolutely no way to figure out which parts come from Qt, and which parts were created by the previous people who worked on the app you're now trying to maintain.

You see some name, it hasn't got a Q or a K or anything in front of it -- so, guess whether it's part of the standard components, something dreamed by those guys who wrote the app you're trying to maintain or something you wrote yourself four weeks ago but had forgotten about.

Lovely.

Sivan Greenberg

unread,
Apr 1, 2012, 12:53:52 PM4/1/12
to Stephen Kelly, devel...@qt-project.org
On Sun, Apr 1, 2012 at 6:56 PM, Stephen Kelly <stephe...@kdab.com> wrote:
>
> I can help out, but only until the end of today I'm afraid.
>
Right, this is my clue that this is indeed an April 1st day joke.

-Sivan

Boudewijn Rempt

unread,
Apr 1, 2012, 12:57:44 PM4/1/12
to devel...@qt-project.org
On Sunday 01 April 2012 Apr, Sivan Greenberg wrote:
> On Sun, Apr 1, 2012 at 6:56 PM, Stephen Kelly <stephe...@kdab.com> wrote:
> >
> > I can help out, but only until the end of today I'm afraid.
> >
> Right, this is my clue that this is indeed an April 1st day joke.
>

Oh gods -- I've been had for the straight man, right :-) I admit it...

benedik...@nokia.com

unread,
Apr 1, 2012, 1:25:37 PM4/1/12
to bo...@valdyas.org, devel...@qt-project.org

Gawd, I'm laughing so hard I can hardly breathe!
Good one João!! :-D

/Benedikte

Rick Stockton

unread,
Apr 1, 2012, 2:17:17 PM4/1/12
to joao.a...@nokia.com, devel...@qt-project.org
I have 4 comments on these changes, and they're all negative. But first,
I THANK YOU for of enormous changes in support of Qt's future use. I
just feel that now is not the time, and have a few other points to make:

(1) dropping the prefix letter in class names, IMO, would need to have
the conversion utility written, tested, and approved as CO-REQUISITE..
And I'm not sure whether we should require both a shell-based version
AND a Windows ".exe" cersion of the converter, too.

(2) We promised a high level of BC, and this compromises that with a
pretty significant "Oh, and by the way.... we lied. All the Class names
change."

(3) As others have said, this will force ISV's source code libraries
into a two-version splits. I strongly disagree with the concept, from
another reply, that "once you modify for Qt5, you should never look
back". Qt Developers can NOT force their users to install Qt 5.x on
machines which they don't control, until Qt5 is well established. There
is a period of time, which I'll SWAG to be approximately a year, when
ISV's must continue support for Qt4 versions of their programs. (I don't
want it to end up like "Qt3Support" either, but the rest of the world
doesn't move instantly.)
This would be sort of like MSVC supporting _only_ Windows-Vista, or
_only_ Windows-7, or _only_ Windows XP. It's extremely difficult to sell
a "new Version" with poor compatibility to the "old Version". We
shouldn't put ourselves in that position, because it would probably make
Qt4 live LONGER.... rather than SHORTER.

(4) "Qt5 is going to be Revolutionary". If our goal is a Revolution,
putting all Widgets under the guillotine, then we shouldn't call it
"Qt5". It should be called some kind of "Q-New-product", at Version 1.0.

With respect and great thanks, I think that it's too early for a change
like this. It doesn't but this doesn't fly without the converter as
PreReq/CoReq-- and it SHOULDN'T fly until Qt5 is well-entrenched in the
Real World.

Alberto Mardegan

unread,
Apr 1, 2012, 2:24:36 PM4/1/12
to devel...@qt-project.org
On 04/01/2012 06:04 PM, joao.a...@nokia.com wrote:
> 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.

I'm not sure what you mean by "move all remaining C++ developers to
JavaScript" -- I would rather move to another toolkit than to JS.

IMHO, a clean QML programming style is when the Javascript expressions
are so clean and simple that one doesn't need to know that it's Javascript.
I certainly wouldn't write the application logic in JS.

As far as the Q namespace is concerned, I'm very much against the
change. If this were the first release of Qt, then I might be fine with
it, but with all the Qt-based applications out there I think this is not
wise.
I understand that Qt 5 is not meant to be source compatible with Qt 4,
but this change sounds like "let's ruin everyone's life just because we
can".

I'm writing some Qt code that I hope to run with minimal adjustments on
devices on which Qt 4.x is installed and on future devices running 5.0;
this change would just make it nearly impossible, for a very uncertain
benefit.

And the "Q" prefix is so tiny and cute, that I honestly prefer writing
"QSize" than "Q::Size" ("using namespace Q" is very likely going to
cause conflicts with other classes of mine).

> Still pending are patches to:
>

[...]


> - rename the Q::Qt namespace to Q::t

urgh...

> 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. The extra separation
> between words will be welcomed by those of us that use small fonts and
> ALL-CAPS editors.

Damn, you fooled me. :-) I was about to ask you how this would help
"interoperability", and was going to write that this sounds like a joke,
when I realized what date it is today. :-)

However, since I cannot rule out for sure that you are not joking, I'll
keep the upper part of my angry e-mail, just in case. :-D

Ciao,
Alberto

--
http://blog.mardy.it <- geek in un lingua international!

Boudewijn Rempt

unread,
Apr 1, 2012, 3:23:06 PM4/1/12
to benedik...@nokia.com, devel...@qt-project.org
On Sunday 01 April 2012 Apr, benedik...@nokia.com wrote:
>
> > On Sunday 01 April 2012 Apr, Sivan Greenberg wrote:
> > > On Sun, Apr 1, 2012 at 6:56 PM, Stephen Kelly <stephe...@kdab.com> wrote:
> > > >
> > > > I can help out, but only until the end of today I'm afraid.
> > > >
> > > Right, this is my clue that this is indeed an April 1st day joke.
> > >
> >
> > Oh gods -- I've been had for the straight man, right :-) I admit it...

>

> Gawd, I'm laughing so hard I can hardly breathe!
> Good one João!! :-D

Now I am as well :D But I have to admit that it did spoil my dinner :-). Maybe because stuff like this really doesn't sound too out of this world!

joao.a...@nokia.com

unread,
Apr 1, 2012, 7:02:28 PM4/1/12
to devel...@qt-project.org
Hello again,

To every-concerned-one-of-you, I hope you do realize that we share all
of those same concerns. We do! :-)

So, let's make Qt 5 the best it can be under the constraints set out by
the previous incantations of Qt and the tone set by our Chief
Maintainer.

If you still have concerns or just want to make thinks better, then do
try out the alpha packages and report back your findings. Better yet,
patch the issues you find and help us do it too!

You can disregard the timestamp on this one (I'm pretty sure):


Or wait a little bit more until the Alpha is out for real.

Let's make Qt 5 happen the way it should.

Cheers,


João

Andre Somers

unread,
Apr 2, 2012, 1:25:50 AM4/2/12
to devel...@qt-project.org
Op 2-4-2012 1:02, joao.a...@nokia.com schreef:
Hello again,

To every-concerned-one-of-you, I hope you do realize that we share all
of those same concerns. We do! :-)

I really enjoyed this joke. Thanks! :-D

André

Artur Souza (MoRpHeUz)

unread,
Apr 2, 2012, 7:34:25 AM4/2/12
to joao.a...@nokia.com, devel...@qt-project.org
2012/4/1 <joao.a...@nokia.com>:

>
> To every-concerned-one-of-you, I hope you do realize that we share all
> of those same concerns. We do! :-)
>

You rock :) The best 1st April joke so far :)

--
-------------------------------------------------------
Artur Duque de Souza
openBossa
INdT - Instituto Nokia de Tecnologia
-------------------------------------------------------
Blog: http://blog.morpheuz.cc
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
-------------------------------------------------------

Sivan Greenberg

unread,
Apr 2, 2012, 7:50:12 AM4/2/12
to Artur Souza (MoRpHeUz), devel...@qt-project.org
I join Artur here, and Qt has *always been* revolutionary. So I don't
expect anything short of qt5.

-Sivan

--
-Sivan

Reply all
Reply to author
Forward
0 new messages