[Interest] Qt5: drawing on X11 root screen (and changing the WId of an existing QWidget)

René J. V. Bertin rjvbertin at gmail.com
Tue Mar 7 09:48:52 CET 2017


René J.V. Bertin wrote:

Hello,

Forgive me for reposting a question I asked yesterday under a hopefully more 
descriptive subject.

I'd still like to know if it's possible in Qt5 to change the WId of an existing 
(just created) QWidget as shown below, and how.

But the main goal of that operation as I now understand is to be able to use the 
X11 root window. There's still a remark somewhere in the Qt documentation that 
"on X11 it is even possible to draw on the root" but I cannot seem to find out 
how. For once Google isn't my friend so much...

Thanks,
René

> 
> I understand that it is no longer possible to use QWidget::create() with the
> same result under Qt5 but it's not clear to me how convert the following kind
> of code (not mine so I may not understand it perfectly):
> 
> class Foo : public QWidget;
> 
> Foo:Foo(WId id)
> : QWidget()
> {
>     if (id) {
>         create( id, false, true );
>     }
> }
> 
> From what I understand this allows to subclass QWidget and still create an
> instance of this new class from an arbitrary WId (an X11 Window in this case).
> 
> The Qt5 replacement
> 
> QWidget::fromWindowContainer(QWindow::fromWinId(id))
> 
> creates a new QWidget which would then have to be converted to an instance of
> the child class, but how?
> 
> Thanks!
> 
> R.





More information about the Interest mailing list