[Qt-qml] Executable code in a model?

Pertti Kellomäki pertti.kellomaki at nokia.com
Tue Nov 16 13:50:05 CET 2010


Is it possible to have executable code as part of a model element? In a 
hypothetical Scheme based QML I could create a list model that contains 
<string, procedure> pairs, and then in a list view a delegate could 
simply call the procedure:

(define file-menu
   (list
       (list "Save"
              (lambda () (save-file)))  ; executable code
       (list "Quit"
              (lambda () (quit))))

Does QML allow something like this, or is there some other convenient 
way to glue together e.g. labels and actions?
-- 
Pertti




More information about the Qt-qml mailing list