> Sent: Tuesday, July 26, 2016 at 1:57 PM
> From: "J-P Nurmi" <jpnu...@qt.io>
> To: "interest@qt-project.org" <interest@qt-project.org>
> Subject: Re: [Interest] Why does QML prefer 'count' over '.length'?
>
> On Tuesday, July 26, 2016 19:02, Jason H <jh...@gmx.com> wrote:
> > I seem to remember that too. Would it be possible to at least add .length 
> > so that we conform to the norm?
> 
> Adding .length to QML "stuff" is not very specific. Where exactly would you 
> like .length to be added? For something like ListView, both .length and .size 
> would be ambiguous, whereas .count is not that easy to misunderstand, is it?


JS uses length on arrays and strings. Anytime you have an array (be it a list, 
etc) the number of items is denoted as .length
It makes no sense to have Qt use count in similar situations. As Thiago 
mentioned length, size and count are all analogous in the C++ API, so I don't 
know how/why they are ambiguous. I write quite a bit of JS code (server and 
mobile) and it seems rather arbitrary to continue to use count. 

Specific places: 
All models. DelegateModel, DelegateModelGroup, ListModel, etc.


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to