Pergunta

I need access to functions that wasn't marked as Q_INVOKABLE nor Q_SLOTS. Qt script module has mechanism called defaultPrototype. I wonder if it possible in QML?

I saw QtDevDays presentatin QtDD12 - QtQuick under the hood - Thomas McGuire and at 18 minute Thomas shows pure QML widget application. I think you cannot achieve it without exporting/exposing some non-invokable functions to script environment.

Is there any mechanism in QML like defualtPrototype in QtScript?

Foi útil?

Solução

QML uses Qt Script under hood, so using the default prototype mechanism is perfectly possible. Only problem is obtaining the script engine of a declarative engine as their is no obvious API for that. Have look at the code in libkdeclarative, especially KDeclarative::initialize(), for a viable hack to do so.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top