variable = 123;
class СVariable: public QObject{ Q_OBJECTpublic: СVariable (CMyData * _data, QObject * _parent = 0) : QObject(_parent) { m_data = _data; } ~ СVariable() {} operator int() { return m_data->var; } СVariable & operator=(const int _var) { m_data->var = _ var; return *this; }protected: CMyData * m_data;};void f(){ СVariable * var = new СVariable (&data); QScriptValue ScriptElem = ScriptEngine->newQObject(var); if (!ScriptElem.isNull()) { m_ScriptEngine ->globalObject().setProperty(variable,ScriptElem) } QScriptValue sv = m_ScriptEngine->evaluate("variable"); sv.isObject(); // dвозвращает true QString script = "variable = 12564;"; sv = m_ScriptEngine->evaluate(script); sv.isError(); // всё нормально sv = m_ScriptEngine->evaluate("variable"); sv.isObject(); // возвращает false}