PDA

View Full Version : How to send mouseWheelEvent to SWF, loaded to QWebView



svarog611
2nd February 2017, 12:33
Good day!

I have a program, written in C++, using Qt 5.5.1 (can't switch to another version), running under Windows (7 or 10, doesn't matter).

So I have some FlashWidget, subclassed from QWebView. It loads html file, parses it and replaces %1 with appropriate path to *.swf



<object
class="flashPlayer"
width=90%
height=100%
type="application/x-shockwave-flash"
id="bridgemovie"
data="%1" >
<param name="allowScriptAccess" value="always"/>
</object>


SWF file has event listeners on mouse events: mouse down, up and mouse wheel



addEventListener(MouseEvent.MOUSE_WHEEL, zoom); //"zoom" is just some internal function
addEventListener(MouseEvent.MOUSE_DOWN, mouseDown1);
addEventListener(MouseEvent.MOUSE_UP, mouseReleased);


Problem: Dragging and clicking works pretty well, but loaded SWF doesn't receive wheel events. I can't modify SWF code, only C++ and HTML parts. So, how I can natively pass mouseWheel event from JS (or, perhaps, QWebView, if allowed so) to the loaded SWF file?
P.S. I've tried loading SWF with QAxWidget, and wheelEvent is received, but there are some rendering problems, so I'm trying to repair solution with QWebView.

svarog611
9th February 2017, 15:17
Well, it looks like a bug in QWebkit, because there is no such problem in newer versions and QWebEngine. Will try use QAxWidget instead.

anda_skoa
10th February 2017, 08:35
There are also some developers working on updating QtWebKit https://github.com/annulen/webkit/wiki

Cheers,
_