[Interest] QML beautifier?

Mark Tucker mark.tucker at airborne.aero
Thu May 15 16:12:22 CEST 2014


Though I would certainly make the order configurable, I'd suggest that the order provided on the QML Coding Conventions page is used as the default for any such tool:

http://qt-project.org/doc/qt-5/qml-codingconventions.html#qml-object-declarations

Mark

-----Original Message-----
From: interest-bounces+mark.tucker=airborne.aero at qt-project.org [mailto:interest-bounces+mark.tucker=airborne.aero at qt-project.org] On Behalf Of Jason H
Sent: 15 May 2014 14:29
To: Interests Qt
Subject: [Interest] QML beautifier?

Sorry for breaking the thread. I was about to sign up for another provider but it seems yahoo has reversed itself.

Anyway, Guido, I'd be open to configuring the order. Many places have a coding style, and I don't see why QML would be any different. My primary interest is a stable text order so that diffs/merges minimize the deltas. As for the right order:

The general rule is most distinguishing attributes first. Example:
id comes first.
primary attributes (text for text items, colors for rectangles) positioning (anchors)
on* event handlers.

If you have a leaf element with several event handlers, you can very easily fill several screens worth. Having the id between two event handlers does not make sense, which implies there is a better way to do things. Also, the presence of an id is a clue that it needs an id. Again, it's not so important what the order is, as long as the order is stable. You know where to look for your property at: beginning of element ({) , middle, or end (})

So in addition to minimizing deltas, you get the ability to navigate the file better.
_______________________________________________
Interest mailing list
Interest at qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list