Translucent window with click-through behaviour
-
I'm making a translucent window using the following flags:
w.setWindowFlags(Qt::Widget | Qt::FramelessWindowHint); w.setParent(0); // Create TopLevel-Widget w.setAttribute(Qt::WA_NoSystemBackground, true); w.setAttribute(Qt::WA_TranslucentBackground, true); w.setAttribute(Qt::WA_PaintOnScreen);
The problem I'm facing is that every portion of the window which is unpainted has an undesiderable effect of click-through that alters the user experience.
Using this simple hack on paint event:painter.fillRect(e->rect(), QColor(0,0,0,1));
Give the wanted effect of a window region that spans through all the window and not just over painted parts.
This anyway is undesiderable since it makes the window effectively opaque (even though is hardly noticeable) and here I am asking for possible solutions to effectively aim and fix this problem -
Hi,
You should add which version of Qt you are using as well as OS you are running on