Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Show QPixmap in Webpage

$
0
0
Hey to all, I am working on my first Qt project in which a client wants to use his HTML5 GUI to control an image processing software. The interaction of buttons and displayed text between Qt and the webview works like a charm so far but I am getting very frustrated with showing images: According to the documentation QtWebKit Bridge [qt-project.org] I implemented a QObject (which contains my QPixmap) and send it to my webpage via addToJavaScriptWindowObject. In my HTML file the JS function that is called after loading tries to draw this Pixmap either to an <img> element or a <canvas> via this code: myNewGraphic.getPixmap().assignTo(document.getElementById("myCanvas")); var context = document.getElementById("canvasElement").getContext("2d"); context.putImageData(myNewGraphic.getPixmap().toImageData()); I read in a bug report [bugreports.qt-project.org] that “assignTo” replaces the “assignToHTMLImageElement”. Sadly neither of these methods work even tough I am sure the QPixmap is transferred to JS as I can read the height and width. Do you have any idea why this could be happening? Or maybe do you have another alternative way of showing images that were processed in my Qt app in the HTML window? I even need to update these images very quickly (should be up to 30 FPS)… Thanks for your help.

Viewing all articles
Browse latest Browse all 13965

Trending Articles