[PyQt] Drawing on desktop (root window) under X11

David Boddie david at boddie.org.uk
Tue Jul 23 10:59:06 BST 2019


On Mon Jul 22 02:29:37 BST 2019, Maurizio Berti wrote:

> The Qt documentation ( https://doc.qt.io/qt-5/qapplication.html#desktop )
> says this about QDesktopWidget:
> 
> On X11, it is also possible to draw on the desktop.

I remember this! :-)

> However, I've not been able to understand how this can be done.
> I found a very old C++ example (
> https://doc.qt.io/archives/3.3/desktop-example.html ) but I couldn't port
> it.
> Installing an eventFilter on the returned QDesktopWidget won't get any
> QPaintEvent (only PolishRequest and Polish events), and subclassing
> QApplication to return a subclassed QDesktopWidget won't do anything too.
> 
> Does anybody know anything about this?

The documentation about drawing on the desktop is very old - from Qt 3, if
not earlier. I remember trying to draw on the desktop with Qt 4 (and maybe
even Qt 3) using similar techniques but didn't manage to make it work.
I would be very surprised if any modern desktop would allow this to be done.

Plus, the painting model changed in Qt 4 to disallow (or deprecate) painting
on widgets from outside of paint event handlers, so some of the tricks used
in the old Qt 3 example won't work now.

David


More information about the PyQt mailing list