Create a Frameless Desktop-Pet-Style Window in Qt
Three key settings for a frameless window
If your window class inherits from QWidget, two lines in the constructor are enough to build the frameless base:
1 | |
What each parameter does:
WA_TranslucentBackground: allows a transparent window background, so PNG transparency does not turn blackFramelessWindowHint: removes the system title bar and borderWindowStaysOnTopHint: keeps the window always on top
Together, these flags turn your window into a “floating transparent image.”
Cross-platform window shape handling
If you want truly “click-through” transparent areas (mouse clicks pass through to the window below), there are two options:
Windows option
1 | |
Do not actively clip the window shape, so semi-transparent edges are not hard-cut into jagged edges.
Linux option (X11)
1 | |
This solution uses the X11 Shape extension to clip the input region at the system level, which is more thorough than handling it in Qt.
Create a Frameless Desktop-Pet-Style Window in Qt
https://greatzaochen.dev/en/posts/8cd07b68/