I'm trying to make a transparent window stays on top (z-order).
I want to implement something like layer that indicates some parameters开发者_StackOverflow中文版 on the other program.
So what I need is to make background transparent, not whole widget with QWidget::setWindowOpacity function.
I found some documents about it
Transparent Backgrounds in Qt 4.1
QWidget Class Reference — Transparency and Double Buffering
The first one explains "New in Qt 4.1: The Backing Store" and the picture is exactly what I want.
The second one explains more details about it. (left picture)
The left widget has no additional properties or widget attributes set. This default state suits most custom widgets using transparency, are irregularly-shaped, or do not paint over their entire area with an opaque brush.
But I don't know how to do it. I'm using Qt 4.6 B.T.W.
Taken from ctd's answer as suggested in the comments: QT4: Transparent Window with rounded corners
this->setAttribute(Qt::WA_TranslucentBackground, true);
精彩评论