QML style guide
Aurélien Gâteau
agateau at kde.org
Tue Oct 30 17:16:26 UTC 2012
Le lundi 29 octobre 2012 21:42:18 Aaron J. Seigo a écrit :
> hi..
>
> we have a style guide for our C++ code: the kdelibs style, which was mostly
> borrowed from Qt. unfortunately for us there was no QML guide we could
> similarly abscond with.
>
> and it shows.
>
> summary -> i've started putting together a QML style guide draft and would
> like your input and to bring it completion in a collaboration with all of
> you who are writing QML for Plasma. to that end, i've started a wiki page
> here:
>
> http://community.kde.org/Plasma/QMLStyle
Good idea. A few comments:
In the example, "property alias bar : actual.property": there is a space
before the colon, is it on purpose?
I think it would be good to standardize the id of the top-level item. So far I
have often seen "main" or "root" used.
JS lines should end with semi-colons. This is expected by JSLint anyway, but I
think it is invasive enough to be mentionned explicitly.
The only part I don't really like is putting left curly brace on its own line
for functions because:
- having different conventions for event-handlers and function code blocks look
inconsistent
- it differs from many coding styles: Qt QML JavaScript, Douglas Crockford,
jQuery, Node... so I think it is going to look odd and unfamiliar to many
newcomers.
Aurélien
More information about the Plasma-devel
mailing list