[Development] Proposing changes to https://wiki.qt.io/Qt_Coding_Style

Allan Sandfeld Jensen kde at carewolf.com
Tue May 9 22:15:19 CEST 2023


On Dienstag, 9. Mai 2023 08:51:37 CEST Marc Mutz via Development wrote:
> Hi,
> 
> I'd like to propose the following clarifications:
> 
> - no space between "operator" and it's symbol:
> 
>      // WRONG
>      bool operator ==(~~~~)
>      // CORRECT
>      bool operator==(~~~~)
> 
> Rationale: that's the style we find in all of Qt, but QtC's
> auto-completion (by default?) adds the space, so we should clarify what
> we want (and fix QtC).
> 
> - exactly one space each between if and constexpr/constinit and
> following [({]:
> 
>     // WRONG
>     if  constinit(
>         if     constexpr(~~~) {
>     // CORRECT
>     if constinit {
>         if constexpr (~~~) {
> 
I prefer the first ones. Though it appears the second is used 75% of the time 
in Qt code.

> - space after template and before <:
> 
>    // WRONG
>    template<class T>
>    // CORRECT:
>    template <class T>
> 

> Rationale: We always used the latter in Qt.

We have always used both. I prefer the first one, which also happens to be the 
default by old Qt styles, but the second one is now more common in QtCore.

That said. I find discussing style-guides in general a waste of time, and will 
agree to anything that make us stop wasting time on this.

Best regards
Allan




More information about the Development mailing list