[Interest] Creating a transparent window that captures mouse events
Jason Kretzer
Jason at gocodigo.com
Fri May 16 06:16:45 CEST 2014
Good Day all!
I am trying to create a transparent overlay over an existing QMainWindow. This is easy to do and I have achieved it in a number of ways while trying to reach my goal. The problem is not making them transparent, the problem comes in when I want the overlay to capture mouse events — specifically the right double click.
This is with Qt 5.2, on Windows 7 Pro.
The best I have been able to accomplish is to set the overlay opacity to 0.1. This feels REALLY hacky to me.
The overlay has had many incarnations as I have tried various things — a QLabel with a transparent.png as the pixmap, a QWidget/QMainWindow with setAttribute(Qt::WA_TranslucentBackground), a QWidget/QMainWindow with setStyleSheet("background:transparent;”), a QWidget/QMainWindow/QGraphicsView with the color palette set to Qt::transparent.
I am using an EventFilter to capture the events. I know it works as when the overlay is opaque, all the proper events fire with nothing getting through.
Anyone know a trick to this?
-Jason
//------------------------------//
Jason R. Kretzer
Lead Application Developer
Jason at gocodigo.com
C:606.792.0079
H:606.297.2551
//-----------------------------//
More information about the Interest
mailing list