[Qt-qml] Transforming a model (like 'list comprehension')

Ville M. Vainio vivainio at gmail.com
Thu Nov 11 00:48:12 CET 2010


On Wed, Nov 10, 2010 at 10:41 PM, Ville M. Vainio <vivainio at gmail.com> wrote:

> Suppose I have model with items like this:
>
> ListItem { x : 1; y: 2 }
>
> And I need a model with items like this:
>
> ListItem { z : 1 + 2 }

To elaborate, it could be handled by something like this (if the
construct were available):

FilterModel {
  source: originalModel
  filter: function(element) { if (element.x < 100) { return true; }
else { return false; } }

  ElementTranslation {
    z : x+y
  }

}


-- 
Ville M. Vainio @@ Forum Nokia



More information about the Qt-qml mailing list