Hi All  

I would like to still get back to the goal of this exercise. From the 
discussion I see at least a couple of conceptually different reasons for "+=".

1) Just accumulation (add one more log line)
2) Make parent care about one more child (one more rectangle to represent one 
more file in the file system)
3) Modify the default set of elements (get a list of files from file system and 
add one "pseudo-file item" for the current dir or mix lists of files from two 
dirs).

IMHO, all of these reasons are best to be solved by the different means, non of 
which seems to require "+=" to me.

1) Just accumulation (add one more log line)
Well, then it's just a Javascript function addLogLine() that might modify 
declarative lists or models if it likes to store log in the declarative 
structures

2) Make parent care about one more child (one more rectangle to represent one 
more file in the file system)
That is more about making the UI follow a dynamically changing model. Model can 
come from C++ or be a QML ListModel. In both cases there are already enough 
facilities to modify he models, UI should follow

3) 3) Modify the default set of elements (get a list of files from file system 
and add one "pseudo-file item" for the current dir or mix lists of files from 
two dirs).
This one is a little more complex and looks to me similar to relational algebra 
where you may like to combine models, intersect them, add pseudo-elements, 
remove/hide some elements (e.g. hidden files). On a C++ side Qt's proxy models 
can help you to some extent, on JavaScript it takes some more manual work.

I had a similar issue lately, a contact list of the instant messenger coming as 
a C++ model needed some modification: a couple of contacts need to be hidden, 
one pseudo-contact is to be added. What I did was a secondary model in QML 
(ListModel) that was recreated/adjusted on every source model modification. 
OnDataChanged handlers were acting almost as predicates transforming the source 
model into a model good for a final UI.

Now that, certainly, diverts the topic a little. The point I am trying to make 
is that I don't see so far a single clear reason for += syntax not achievable 
with the current QML/JS mechanisms.

Cheers,
Artem.

--  
Artem Marchenko
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Wednesday, 2 May 2012 р. at 11:22, Sven Anderson wrote:

> On 01.05.2012 13:58, Charley Bay wrote:
> > Bo Thorsen respondeth:
> > += doesn't make any sense here. It's for the javascript code only.
> >  
>  
>  
> You can also just say: += creates an invalid loop binding. And we all  
> accept, that loop bindings cannot work.
>  
> > Item {
> > some_val: parent.some_val; // binding to parent
> > some_val2: 10; // assign value (not bind)
> >  
>  
>  
> I don't agree. Semantically this is a normal binding to a constant  
> value. That some binding overhead is avoided in this case, because there  
> will never be an update, is an implementation detail, that isn't  
> important to the QML developer.
>  
>  
> BR
>  
> Sven
>  
> _______________________________________________
> Qt-qml mailing list
> Qt-qml@qt.nokia.com (mailto:Qt-qml@qt.nokia.com)
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
>  
>  


_______________________________________________
Qt-qml mailing list
Qt-qml@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to