Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
WA_TranslucentBackground can't capture mouse event
-
Hello everyone,
I have a problem. Could somebody give me some advise?
I create a dialog. I want it to be transparent. So I set the attribute WA_TranslucentBackground. It works as expected.
But it couldn't capture mouse event in the region that is transparent.
Does somebody know the solution? Could you tell me, please?
Thanks.
My enviroment:
Windows 7
-
Not possible directly. Just a thought. Can you try setting the background color on your own with minimum opacity value ?
-
@dheerendra
Thanks you.I want to say it works on Ubuntu 16.04.
I don't know your meaning by setting background color actually.
I have tried this code. But it's black.
QPalette pal = palette();
pal.setColor(QPalette::Background, QColor(0x00,0xff,0x00,0x00));
setPalette(pal);
-
On Windows, I got the same problem. The top level window with WA_TranslucentBackground cannot receive mouse pressing and releasing events when setMouseTracking to true.