[Interest] QML property lint suggestion

Ulf Hermann ulf.hermann at qt.io
Mon Feb 17 09:33:32 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"

You probably mean QQuickItem::data(). It is not QML that came up with 
the name, but rather QtQuick. It would be appropriate to make that 
property FINAL in Qt6, so that you do get a warning when trying to 
shadow it. I don't think we can change the name at this point, but 
adding an alias might be possible.

Ulf


More information about the Interest mailing list