Is it possible to display translucent and/or irregular-shaped windows with Qt?
(I’m assuming it ultimately depends on the capabilities of the underlying GUI system, but let’s assume at least Windows XP / Mac OS X)
If so, how does one accomplish this?
Yes, it is possible. The key is the
Qt::WA_TranslucentBackgroundattribute ofQWidgetHere is a simple class that draws a round translucent window with a red background 50% alpha.
TranslucentRoundWindow.h:
TranslucentRoundWindow.cpp:
If you want to be able to move this window with the mouse, you will have to override
mousePressEvent,mouseMoveEventandmouseReleaseEvent.