[Qt-qml] Executable code in a model?

Gregory Schlomoff gregory.schlomoff at gmail.com
Tue Nov 16 16:32:25 CET 2010


Ah, sorry, If I understand well, you actually want to do that with
standard ListModel / ListElement? This is not possible with
ListElement, but could probably be done with VisualItemModel

My example was assuming two custom QML components (Menu and MenuItem),
and not the standard QML model items.

Short answer: you have to try out for yourself, but you will certainly
come up with a solution.


2010/11/16 Pertti Kellomäki <pertti.kellomaki at nokia.com>:
> On 11/16/2010 03:00 PM, ext Gregory Schlomoff wrote:
>>
>> Easy, just bind your javascript code to a signal or a property.
>>
>> QML version of your pseudo-code :
>>
>> Menu {
>>   MenuItem {
>>     title: "save"
>>     onActivated: {
>>         var file = ....
>>         file.save();
>>     }
>> }
>>
>
> Thanks, I was hoping it would be this easy. Presumably I can then access the
> onActivated handler in the delegate via the view's currentItem property?
> --
> Pertti
>
>




More information about the Qt-qml mailing list