I have looked the Qt example about QWebChannel .
But its a C/S app. BTW it doesn't work on my computer(OS X 10.10.5, Qt5.5).
All my HTML contents come from local disk. I don't think it needs socket things.
new QWebChannel(navigator.qtWebChannelTransport, function(channel) {
// all published objects are available in channel.objects under
// the identifier set in their attached WebChannel.id property
var foo = channel.objects.foo;
// access a property
alert(foo.hello);
// connect to a signal
foo.someSignal.connect(function(message) {
alert("Got signal: " + message);
});
// invoke a method, and receive the return value asynchronously
foo.someMethod("bar", function(ret) {
alert("Got return value: " + ret);
});
});
There is no
navigator.qtWebChannelTransport
such a thing, JS stopped there.
What should I fill with the first parameter ?
For QtWebEngine, you have to use qt.webChannelTransport
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With