0

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!

Arnold Spence
  • 20,892
  • 7
  • 69
  • 66
miguel
  • 149
  • 1
  • 9
  • I seem unable to replicate this. Please provide more details, including what platform you're on. – Theodore Lytras Jan 12 '13 at 11:31
  • my OS is Windows, I tried on WinXP and Win7, they all have this issue. I use style sheet on these widgets too. And use anti-Aliased font: Arial. – miguel Jan 12 '13 at 11:35
  • I draw transparent black background in paintEvent. Maybe it is the black background make the white corners more obvious. – miguel Jan 12 '13 at 12:19

1 Answers1

0

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 :)

miguel
  • 149
  • 1
  • 9