Drawing on desktop (root window) under X11

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Drawing on desktop (root window) under X11

Maurizio Berti
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.

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?

Thanks,
Maurizio

--
È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Drawing on desktop (root window) under X11

David Boddie
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
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Drawing on desktop (root window) under X11

Maurizio Berti
Il giorno mar 23 lug 2019 alle ore 12:00 David Boddie <[hidden email]> ha scritto:
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.

I thought the same thing, but I decided to give it a try anyway.

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.

Indeed. Also, QDesktopWidget is obsolete for Qt5.
I tried to send a QPaintEvent to QApplication, but got this:
StdErr: QWidget::paintEngine: Should no longer be called
QPainter::begin: Paint device returned engine == 0, type: 1

The same happens if I try to send that event to a new QWidget with Qt.Desktop 
set as windowFlag (which doesn't call the paintEvent itself anyway).
Creating a new QWidget with the QDesktopWidget as a parent doesn't work either.

I seem to remember that it was (is?) possible to do it using Gtk along with Cairo, 
but that was more than 5 years ago.

Does anyone know if it's possible to draw on the root window on X11 via Qt or,
at least, Python?

Thanks,
Maurizio

--
È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt