[Qt-qml] Executable code in a model?

Pertti Kellomäki pertti.kellomaki at nokia.com
Wed Nov 17 10:15:39 CET 2010


On 11/17/2010 01:25 AM, Alpert Alan (Nokia-MS-Qt/Brisbane) wrote:
> While I'm going to withhold judgment for now on whether what I'm suggesting is
> a good idea, you can just have strings of javascript in the model and execute
> them with eval(). e.g
>
> ListModel{
> ListElement{
> 	name: "Save"
> 	action: "saveFile()"
> }
> ListElement{
> 	name: "Quit"
> 	action: "Qt.quit()"
> }
> }
>
> and inside the delegate somewhere: eval(action);
>    
I'll leave that for the real desperate situations ;-)  Even in Lisp 
world the use of eval quite often indicates broken design.
-- 
Pertti




More information about the Qt-qml mailing list