[Interest] QML property lint suggestion

Jason H jhihn at gmx.com
Sat Feb 15 16:57:03 CET 2020


I'm here watching Ulf's QtWS19 QML talk and had a thought...
I might be dumb or crazy (either are equally likely) but, the other day I added a property called 'data' and completely broke my application. It was to store data I received. However QML also declares a property 'data' which is essential to Qt. But I never got an error or warning. So my suggestion is to have some warning (or error?) like "declared property 'data' shadows an existing property"

I think some talk of naming an essential-to-QML property as generically as 'data' is also worth a discussion. Naming it 'data' doesn't really describe what it is for, which is holding the children, all the children. The problem with that, is as it currently stands, the property 'children' is used to store only visual children, so I would suggest to rename that 'visualChildren', or 'childItems'. Next for the non-visual children, aka 'resources' (equally poorly named, because Qt has a 'resource' system), they should be in 'childObjects' or 'nonvisualChildren'. (But definitely not 'invisibleChildren', because is that visible=false or opacity==0 property thing?)



More information about the Interest mailing list