0

I am writing a Qt5 PySide2 scritp on Ubuntu 20.04.

I would love to make part of a window transparent, say a frame, so that I can see other window programs (such that Firefox, LibreOffice etc) that are below of the window. (If this is not possible it would be ok if the entire window was translucid, which I already know how to do, but I also need to display some pushButtons and other widgets aside and be able to interact with them). I am able to do this with

Qt.WA_TranslucentBackground

Where my application is transparent (part (I would love) or entire window (it is quite acceptable), whatever the solution) I also need to be able to interact with the program below. I am able to do this with

Qt.WindowTransparentForInput

The problem arise when I try to combine these two features. In the first case I get a transparent window but cannot interact with what's below. In the second case I get an opaque window but I can interact with what's below, although in a blind fashion.

I saw that by adding Qt.FramelessWindowHint solves both, but then I can no more move the window and I would also like to keep the title window's decorations, like the x for close windows or - for minimizing it.

The ultimate goal for me is to paint arrows over a transparent Qt5 canvas in my program, the end user can see the arrow, can see the webpage below and can interact with that webpage. But not only browsers, I would like for people with disabilities and old people to get visual aids in other programs too. It is by this mean that I would prefer if only part of my GUI be transparent (I already said of a frame) because the user should always see that the program is on top of other applications.

Thanks

enter image description here enter image description here

Jacquelyn.Marquardt
  • 602
  • 2
  • 12
  • 30
  • So, if I get it correctly, you just want a window that has a border and some objects, while the rest is both visually and mouse transparent, so you can see the other windows under it, and interact with them? – musicamante Feb 24 '21 at 14:52
  • @musicamante yes exactly. can you help me please? – Jacquelyn.Marquardt Feb 24 '21 at 16:04
  • 1
    Does this answer your question? [Is it possible to create QMainWindow with only outer border?](https://stackoverflow.com/questions/57717331/is-it-possible-to-create-qmainwindow-with-only-outer-border) – musicamante Feb 24 '21 at 16:28
  • 1
    Note that if you need to add widget "hovering" your window, you must add their geometry to the region created for the masking: `region |= QtGui.QRegion(self.someFloatingWidget.geometry())` – musicamante Feb 24 '21 at 16:30
  • @musicamante I cannot interact with windows below and I cannot move or resize the window unfortunately with the code you referred – Jacquelyn.Marquardt Feb 24 '21 at 18:06
  • That might depend on the implementation that *that* question required, but the fact remains: for what you're asking, you need to use `setMask()` as shown there. Also note that `Qt.WA_TranslucentBackground` and `Qt.WindowTransparentForInput` are probably incompatible (and actually not required) with that, so you should not use them. – musicamante Feb 24 '21 at 18:21
  • I see you've created a bounty for this. Considering that the most probable solution requires using `setMask` as described in the other answer, you should try to clarify what you tried and *how* it doesn't solve your issue, possibly by expanding your question with a MRE showing us what is fine and what isn't. Otherwise it's unlikely that another answer would be given in the meantime, and you risk losing the reputation and still have no solution to your issue. – musicamante Mar 01 '21 at 13:51

0 Answers0