I want to make a translucent window in Qt:
setWindowFlags(Qt::Popup| Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground,true);
But Once I set the Qt::WA_TranslucentBackground to true, there will be white things on the four corners of each widget:
It appears whenever the mouse hover though the widget,or click on it.
How to avoid this ? If I set the Qt::WA_TranslucentBackground to false, the problem will be gone. But I need transparent window.
Thanks beforehand!
I worked it out myself.
There are two reasons together that make these artifacts happen:
I have turned on the translucence background for the window ,and use QPainter to manually draw the window’s rouned-corner background . When the mouse hover/press on the Children widgets, the update(QRect) the widget sent to window widget does not compute the background well.
When I use stylesheet to draw the background, problem solved 🙂