Greeting
Is there anyway to get return value of Q_INVOKABLE
function in Qt webEngine
without passing callback function ? (Qt Documentation) . Like what we were doing in Qt WebKit
.
More Information About Question
In QT4
and Qt WebKit
i could get my function result as QVariant
and cast it to JSON
or any other type.
For example in my c++ project i have the following function that return application's version as QVariant
.
Q_INVOKABLE QVariant getAppVersion();
I could simply use the following line in my HTML
file and get result.
var applicationVersion = ApplicationObject.getAppVersion();
Now With Qt 5.5
and Qt WebEngine
i have to use following form in order to get the result.
ApplicationObject.getAppVersion(myResultFunction);
function myResultFunction(result){
console.log(result);
}
I'm using QT 5.5
And Visual Studio 2013
.
Thanks in Advance
Well, There is not other way. You have to pass callback
function.
But with using promise
in javascript
, It gets alot better!
Good luck