[Interest] Which Qt-graphics module to choose when dealing with implementing a Wayland compositor with Qt-Compositor module?

Samuel Rødal samuel.rodal at digia.com
Tue Oct 9 09:11:43 CEST 2012


On 10/08/2012 10:05 PM, Tim Bienias wrote:
> Hello qt'ers,
>
> currently I'm developing a compositor with the QtWayland-module.
> The compositor shall show Wayland-clients, but only one client at a
> time. When you wipe over the surface the compositor switches to the next
> client.
> There shall also be transparent overlays.
> On the attached image, you see what picture is in my mind.
>
> My minds picture[Link] <http://i45.tinypic.com/f2j6nt.png>
>
> I've studied multiple ways to do Qt-graphics, but now I don't have a
> real clue which to go.
>
> The ways I figured out are:
> 1. Like in the example of QWindowCompositor - Create a QWindow with a
> QOpenGLContext in it and render everything (Wayland-clients & overlays)
> on the context. There would be a general question if i could render
> GUI-elements like QPushButton on it?
> 2. Have one or multiple QGLWidgets where things get rendered to. One
> QGLWidget for the Wayland-clients and maybe another for the overlay-icons.
> Here would be an issue which painter to use - QGLPainter or QPainter?
> 3. GraphicsView with OpenGL rendering port and create multiple canvas
> for Wayland-Clients and overlays.
> 4. Qt3D ?

You shouldn't need more than one native window for this so I think 
option 2 can easily be discarded. Option 1 would require reinventing a 
lot of wheels since QWindow doesn't offer any convenience like 
QPushButton or QtQuick items for input etc. Using the QWindow API 
directly is mostly useful for porting games that already do their own 
rendering.

For this kind of use case I think QtQuick 2 is a best fit, i.e. a 
QQuickView. Have a look at the QML compositor among the qtwayland 
examples, it should be really easy to customize it to work the way you 
had in mind.

For example, the transparent overlay would be as simple as

Rectangle {
     width: parent.width
     height: 100
     color: "white"
     opacity: 0.2
}

Containing a Row, ListView, or similar for the icons.

--
Samuel



More information about the Interest mailing list