MainWindow.centralWidget.webView.url = MainWindow.centralWidget.lineEdit.text;
print(MainWindow.centralWidget.webView.url);
obj = {}; obj.__defineGetter__("x", function() { return this._x; }); obj.__defineSetter__("x", function(v) { print("setting x to", v); this._x = v; }); obj.x = 123;
MainWindow.centralWidget.webView.__defineGetter("propUrl", function() {return this.url();});MainWindow.centralWidget.webView.__defineSetter("propUrl", function(url) { this.setUrl(url);});
#include <QScriptTools>QScriptEngine engine;QScriptEngineDebugger debugger;debugger.attachTo(&engine);debugger.action(QScriptEngineDebugger::InterruptAction)->trigger();
webView.setUrl(lineEdit.text);
Uncaught exception at :/script.js:33: TypeError: Result of expression 'webView.setUrl' [undefined] is not a function.
webView.url = lineEdit.text;
webView.setProperty("url", lineEdit.property("text").toString());
print(lineEdit.text);print(webView.url);
MainWindow.centralWidget.webView.url = new QUrl(MainWindow.centralWidget.lineEdit.text);
QScriptValue stringToUrlWrapper(QScriptContext* context, QScriptEngine* engine){ if (context->argumentCount() == 1) return engine->newVariant(new QUrl(context->argument(2).toString())); return engine->undefinedValue();}
engine->globalObject().setProperty("stringToUrl", engine->newFunction(stringToUrlWrapper));
MainWindow.centralWidget.webView.url = stringToUrl(MainWindow.centralWidget.lineEdit.text);
return engine->newVariant(Url(context->argument(0).toString()));
qScriptRegisterMetaType<QUrl>(engine, QUrlToScriptValue, QUrlFromScriptValue);
QScriptValue QUrlToScriptValue(QScriptEngine *eng, const QUrl &ba) { return eng->newVariant(ba); }void QUrlFromScriptValue(const QScriptValue &obj, QUrl &ba) { ba = QUrl(obj.toString()); }