will i be able to use all the methods of QTcpsocket class from within the js file(java script file).
Added after 25 minutes:
QString scriptFileName
("./AnotherJs.js");
QFile scriptFile
(scriptFileName
);
engine.evaluate(scriptFile.readAll(), scriptFileName);
bool b1 = engine.hasUncaughtException();
scriptFile.close();
ctor = engine.evaluate("on_jsfile_clicked");
b1 = engine.hasUncaughtException();
scriptUi = engine.newQObject(&socket, QScriptEngine::ScriptOwnership);
b1 = engine.hasUncaughtException();
//QMetaObject *objmeta = new QMetaObject;
//QTcpSocket objsocket;
//objmeta->cast(&objsocket);
//engine.newQMetaObject(objmeta,ctor);
tcpsocket = engine.scriptValueFromQMetaObject<QTcpSocket>();
engine.globalObject().setProperty("QTcpSocket", tcpsocket);
calc = ctor.construct(QScriptValueList() << scriptUi); // this line gives error,why this is so? (error in the sense engine.hasUncaughtException() returns true value).
b1 = engine.hasUncaughtException(); //and socket is not getting connected to server
QString scriptFileName("./AnotherJs.js");
QFile scriptFile(scriptFileName);
scriptFile.open(QIODevice::ReadOnly);
engine.evaluate(scriptFile.readAll(), scriptFileName);
bool b1 = engine.hasUncaughtException();
scriptFile.close();
ctor = engine.evaluate("on_jsfile_clicked");
b1 = engine.hasUncaughtException();
scriptUi = engine.newQObject(&socket, QScriptEngine::ScriptOwnership);
b1 = engine.hasUncaughtException();
//QMetaObject *objmeta = new QMetaObject;
//QTcpSocket objsocket;
//objmeta->cast(&objsocket);
//engine.newQMetaObject(objmeta,ctor);
tcpsocket = engine.scriptValueFromQMetaObject<QTcpSocket>();
engine.globalObject().setProperty("QTcpSocket", tcpsocket);
calc = ctor.construct(QScriptValueList() << scriptUi); // this line gives error,why this is so? (error in the sense engine.hasUncaughtException() returns true value).
b1 = engine.hasUncaughtException(); //and socket is not getting connected to server
To copy to clipboard, switch view to plain text mode
Bookmarks