[Interest] Beautifier for QML

Shantanu Tushar shaan7in at gmail.com
Wed Feb 8 14:41:38 CET 2017


Hi,

On Sun, Feb 5, 2017 at 10:36 PM, Gunnar Roth <gunnar.roth at gmx.de> wrote:
>
>> i I was wondering if anything similar existed
>> for QML?
>
> 1. Look under menu extras/qml/js in QtCreator there is a format code entry. It is a bit sad , that you cannot assign the same key combination to c++ formatting as to qml/js formatting. You also cannot make qtc format qml/js code on  save as you can for c++ code. see QTCREATORBUG-16837

Yes there is indeed support for auto formatting QML as well, but no
option to format-on-save.

> 2. There is a github project which extracts the functionality of the formatting as a standalone tool to be used from command line or a git commit hook script. https://github.com/jesperhh/qmlfmt. There is also QTBUG-55757

Cool, as a hack I'm planning to write a wrapper shell script to astyle
which detects if it runs on qml files in which case it will run
qmlfmt, and the normal astyle for others. Lets see how that goes.

>
> I miss the functionality to let the formatter also change the order of properties, states, function, aliases etc. so that it follows a common rule set.

Yep, that'd be so nice!

>
>
>> Quite a lot of devs in our team are shying away from Qt/QML
>> because of that reason.
> Really? Modern times… in school we had to use cards and blackened squares on it to program a wang computer ...
>
> Regards,
> Gunnar Rioth
>

Thanks,

-- 
Shantanu Tushar    (UTC +0530)
shantanu.io



More information about the Interest mailing list