// More expressive design similar to Python list comprehensions that does not work by default for Read/Write
QModelWriter<>(&customModel).sequence().bindWith([&](Seq<Cursor>&&s){// See https://stackoverflow.com/questions/18889028/a-positive-lambda-what-sorcery-is-this
QModelWriter<>(&customModel).sequence().with([&](Seq<Cursor>&&s){// See https://stackoverflow.com/questions/18889028/a-positive-lambda-what-sorcery-is-this
for(auto&&person:persons){// Read would require looping while !s.item()
s=s// To keep working with the active Cursor
.record()
.bind("first name",person.firstName)
.bindWith("office phone",[&](Val<Cursor>&&v){
.item("first name")
.meta(qmColor,person.age>=42?"green":"blue")
.bind(person.firstName)
.item("office phone")
.with([&](Val<Cursor>&&v){
for(auto&&phone:person.phones){
if(phone._t==Phone::Office){
returnv.bind(phone._n);
...
...
@@ -1023,7 +1026,7 @@ void doGuiExample() {
});
#endif
// The same design allows flattening trees into a sequence