feat(ui): provide a view that can be overlayed on 3D scenes
Description
Currently, we abuse SliderView
to overlay widgets on top of 3D scenes, like in SightViewer for instance. However, this class was not really designed for this. Its usage is very verbose in XML. And more importantly, it suffers from two bugs:
- depending on the desktop managers (KDE for instance), the views may not follow the window movement,
- with NVidia mobile drivers, the transparency does not work and is replaced by a black color.
#857 (closed) will add the possibility to draw QWidget on top of 3D scenes, removing the need of the native window trick, resolving the two bugs above. However, SliderView is still necessary to draw QWidget on top of 3D scenes. A new, simpler way to create overlays on top of 3D scenes must be designed.
Proposal
Optional section to give some functional or technical hints
Functional specifications
A new layoutManager OverlayLayoutManager
is created. An example would look like this:
<service uid="mainView" type="sight::module::ui::base::SView">
<gui>
<layout type="sight::ui::base::OverlayLayoutManager">
<view />
<view x="0" y="0" minWidth="55" minHeight="100" />
<view x="-1" y="0" width="50" height="55" visible="false" />
<view x="0" y="-1" height="35" width="100%" visible="false" />
<view x="-50%" y="0" width="400" height="300" />
</layout>
</gui>
<registry>
<parent wid="${WID_PARENT}" />
<view sid="scenesView" start="true" />
<view sid="topToolbarSliderView" start="true" />
<view sid="rightToolbarSliderView" start="true" />
<view sid="videoSliderView" start="true" />
<view sid="advancedQueryEditorSliderView" start="true" />
</registry>
</service>
In OverlayLayoutManager, we would define a list of views. The first view is the background widget, which would typically be a scene. The other one are overlays, we may define properties such as x
, y
, width
, height
to indicate where the overlay should be drawn and what its size should be. By default, x
and y
are the offset from the left and the top respectively, however if they are negative, then it is the offset from the right and the bottom respectively. By default, it's absolute sizes in pixel, however if %
is appended, then it is relative to the size of the parent widget.
Technical specifications
OverlayLayoutManager will use a layout for its background widget, so that it fills the content of its parent. The overlays won't use use a layout, so that it is our responsibility to place them in the application, following the XML configuration.
Test plan
GUI tests.