Const string& in QScript (Qt 4.6)
-
Hello everyone,
I've been using QScriptable to enable a c++ class to be used in QScript.
I've also been registering some of the return types of the (newly set as) public slots for the above mentioned class to be available in QScript as well
I can’t seem to figure out a way to register a (const string&) to be a recognized type for use in the script nor have I found a solution online.
This is an example of how I hooked up std::string successfully
@
//Register string with the meta system
Q_DECLARE_METATYPE(string);
@…
@
qRegisterMetaType<string>("string");
@…
@
//Identify to the script engine what conversion functions to use for type string
qScriptRegisterMetaType<string>(&this->engine, & MyScriptHandlingClass::stdStringToScriptValue, & MyScriptHandlingClass::stdStringFromScriptValue);QScriptValue string_ctor = this->engine.newFunction(&MyScriptHandlingClass::createStdString);
//Identify to the script engine what function is to be used to create new strings in the script
this->engine.globalObject().setProperty(“string”, string_ctor);
@Does anyone have any solutions and/or advice that would help me resolve this issue?
Thank you very much in advance,
-Steve