Important: Please read the Qt Code of Conduct -

Can I create a translucent window

  • Hi,

    I'm using QPixmap.grabWindow to get the contents of an existing X11 App's window (Orig).

    I also want to draw my own translucent window over Orig, so that:

    1. grabWindow still works for Orig, as if it isn't obscured by the visible details in my window
    2. mouse and keyboard events pass through my window

    I understand the concept of an overlay, but the docs only mention QGLwidget being drawn underneath regular widgets. Is it possible to meet my requirements in Qt?

  • Failed to replicate this with qtruby. I'll try with c++ later.

    For now I tried drawing the grabWindow pixmap in MyWindow's paintEvent. I then set MyWindow to always-on-top in gnome and tried alternately clicking each window's title-bar while MyWindow was partly covering the original.

    Unfortunately this caused recursive garbage. This means the window has to be on top for grabWindow to work. I've heard modern X11 implementations maintain a pixmap of each window in memory but I guess xlib and in turn qt ignore this feature.

    When I started the thread I was under the impression there was a way of drawing to an overlay, which I thought could exist above the default screen. I'm going to assume this isn't true.

    That leaves raising the original window before I paint mine. So I'm looking for a Qt function which accepts an arbritrary window id and sends a raise event.

    1. mouse and keyboard events pass through my window

      1. Qt::WA_TransparentForMouseEvents or

      2. QWidget::setMask() -> you need to calculate region of MyWindow which can be painted and pass that to setMask function.

Log in to reply