-
Notifications
You must be signed in to change notification settings - Fork 0
[Idea] Unwrap QWebEngineView for active web widget #201
Description
We still have problems with widgets using a QWebEngineView wrapped in a QGraphicsProxyWidget. One of the most obvious are drop down menus which are not working. The former workarounds have no effect with current versions of Qt 6. The associated QTBUG-109068 is not resolved. Removing the live thumbnails completely also does not help.
So I'm starting here with another idea: Everything works fine when you convert the widget to a tool. Tools are implemented by a "normal" QWidget displayed on top of the board scene. Could we somehow just convert the currently active web widget to a "plain" QWebEngineView?
A tool as it is currently implemented is not the perfect solution. What would we need:
- The widget position should follow panning of the scene.
- The zoom factor of the widget should follow the zoom factor of the scene. See below.
- The widget should be mirrored to the display screen.
- The widget should be recorded in a podcast.
- The widget should be shown in the (live) thumbnails.
Creating the widget
When a tool widget is created, a copy of the original widget is made. The original widget is hidden and the copy is shown. This however involves reloading the embedded web page. We do not want that to happen here. So instead we would
- First unembed the
QWebEngineViewfrom theQGraphicsProxyWidget. - Then make it a child of the board view and set the correct position.
- Then set the zoom factor and adjust the size accordingly.
When the widget becomes inactive, we revert these operations.
Zoom
You cannot zoom a QWidget. But QWebEngineView allows to set a zoom factor of the page. Values are limited to the range 0.25 to 5.0. So not everything we can do with the scene is possible here. But I think that most practical use cases are covered.
We have to decide what we do when the zoom factor of the scene is outside of that range.
Z-Level
A converted widget is always shown on the top. So z-level manipulations are not possible in this state. What options do we have?
- We could do the conversion only when using the Finger tool and not with the Selector.
- We could do the conversion only with the first mouse click inside the web widget after selection.
- We could revert the conversion when the user clicks on the z-level up or down buttons.
Edit: I now implemented unwrapping when the mouse enters the widget and re-wrapping when it leaves it again. If we move the pointer to the z-level buttons, then it is outside, i.e. the view is wrapped, and therefore sensitive to z-level changes.
Not converted web widgets
There are web widgets which would not need conversion, e.g. those, which have no interaction, e.g. Horologe. We could add a flag to the widget telling whether conversion is needed or not.