Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Controlling the Drop-down Menu from a HTML <SELECT> tag
b3nn0 last edited by
I'm trying to automate mouse input on a QWebView (subclass), which works pretty good. However, I am not able to send mouse events to the menu that's created from a html <select> tag.
What I am trying to do:
I'm creating custom QMouseEvents that are sent to the QWebView. And the QWebView opens the <select>-menu if required.
If I send another QMouseEvent to the QWebView, nothing happens (i.e. nothing from the menu is selected).
I also tried to send the event to QApplication::activePopupWidget(). That will close the <select>-menu, but will not select an item. I thought the reason might be wrong coordinates, but that doesn't seem to be the case.
In fact, I tried to "brute-force" find the correct coordinates to select something from the menu, but that diddn't work. The menu always just closed.
Finally, I even tried to cast the activePopupWidget() to a QMenu*, hoping it would be a QMenu, but that doesn't seem to be the case --> that made the application crash.
Long story short;
Is there any possible way to programmatically select an item from a HTML <select>-tag with QWebView?