Questions tagged [qtwebchannel]

Qt WebChannel enables peer-to-peer communication between a server (QML/C++ application) and a client (HTML/JavaScript or QML application).

26 questions
21
votes
4 answers

How to use Qt WebEngine and QWebChannel?

I'm using the new WebEngine to play around and learn. I've been trying to find some similar methods found using Qt WebKit: addToJavaScriptWindowObject() I found that using Qt WebEngine, I have to use the QWebChannel to register functions to the…
user1185305
  • 875
  • 2
  • 15
  • 26
8
votes
1 answer

PyQt QtWebChannel: calling Python function from JavaScript

I am trying, using Qt classes QWebEngineView, and QWebChannel to make a simple connection between HTML page and Python script. The goal is simply to execute foo() when the header

is clicked. import sys from PyQt5.QtCore import pyqtSlot from…

MrLoon
  • 831
  • 1
  • 8
  • 16
5
votes
1 answer

How to detect button click inside Qwebengine in pyside2

I wrote an app in pyside2, which opening a webpage in QWebEngine. That web page has 2 buttons, I am not understanding how can I detect a button click in pyside2 app module, I need to perform other operation on that button click. Example below is…
4
votes
1 answer

Warnings when instantiating QWebChannel object in javascript

I have a widget which creates a google maps instance using QWebChannel. When instantiating the QWebChannel within javascript several warnings appear: Property 'accessibleName'' of object 'MapWindow' has no notify signal and is not constant, value…
Evan Brittain
  • 547
  • 5
  • 15
4
votes
1 answer

folium popups with QtWebChannel

I am displaying a folium generated HTML(for leaflet.js) in a QtWebEngineView. In the popups I have a button w/ an on-click function that's supposed to call a method back in python. But I cant seem to get the channel to work. I'm not sure if I'm…
3
votes
1 answer

How to receive data from python to js using QWebChannel?

I'm trying to get my PyQt application to communicate with the JS but am unable to get values from python. I have two slots on the python side to get and print data. In the example a int is passed from JS to python, python adds 5 to it and passes it…
Evan Brittain
  • 547
  • 5
  • 15
3
votes
1 answer

PySide2 and supporting addToJavaScriptWindowObject

I am trying to port PySide application version #1 to PySide2 and struggle to find the solution for porting following code snippet: class AppManager(QtCore.QObject): ''' methods of AppObject will be available from javascript ''' def…
SpanishBoy
  • 2,105
  • 6
  • 28
  • 51
2
votes
1 answer

QML WebEngineView + WebChannel not loading the script

Trying to use QML WebEngineView + WebChannel (Qt 5.15), but when running the videoTime script, I get js: Uncaught ReferenceError: QWebChannel is not defined Here is a reproducible example import QtQuick 2.15 import QtQuick.Window 2.15 import…
Pa_
  • 641
  • 1
  • 5
  • 17
2
votes
0 answers

How can someone use QWebChannel over an existing TCP/IP connection (QTcpSocket)?

I am attempting to figure out how I can implement a QWebChannel that sends data via an existing QTCPSocket instead of via its default QWebSocket method. Here's something I attempted already, however I could not establish a connection: I have made…
mike510a
  • 2,102
  • 1
  • 11
  • 27
2
votes
1 answer

Eliminate QWebChannel property notifier signal warnings

I'm using QWebEngineView with QWebChannel, similar to this: class AppView(QWebEngineView): def __init__(self): QWebEngineView.__init__(self) self.ch = QWebChannel(self.page()) self.page().setWebChannel(self.ch) Then I…
Dre Westcook
  • 603
  • 6
  • 7
2
votes
1 answer

QWebChannel sends null QVariant POD structs to JavaScript

I am writing a C++ QWidget application that communicates with JavaScript running in a resource hosted web page. I need to find a way to send an array of the following POD structs to a JavaScript function hosted in the web page but unfortunately the…
johnco3
  • 2,401
  • 4
  • 35
  • 67
2
votes
1 answer

Qt WebView and WebChannel over WebSockets in QML

I want to access QtObject from HTML-page running in WebView - invoke methods, read/write properties, etc. As far as I understood, I need to establish WebSockets connection between QML and HTML sides, and then use it as a transport for…
retif
  • 1,495
  • 1
  • 22
  • 40
1
vote
1 answer

QWebEnginePage interactive with javascript not working?

I am not familiar with javascript and QWebEnginePage. When i set self.content.setText('text') content, the QWebEngineView content not changed? The python code class Document(QObject): textChanged = pyqtSignal(str) def __init__(self): …
jett chen
  • 1,067
  • 16
  • 33
1
vote
1 answer

Pyqt5 Move window from QtWebChannel

I am trying to make the mousePressEvent and mouseMoveEvent event work to move my app window from QtWebChannel. I am using self.setWindowFlags (QtCore.Qt.FramelessWindowHint) to remove window flag and use a custom one with html, css and js. Inside…
Oni
  • 41
  • 8
1
vote
0 answers

qt.webChannelTransport from sub-frame

Is it possible to use the qt.webChannelTransport from a sub-frame? It seems like QWebEnginePage.setWebChannel only creates the qt.webChannelTransport object in the top frame. I've considered trying to inject scripts to handle cross document…
DRayX
  • 1,043
  • 2
  • 12
  • 19
1
2