Transparent background Style
Hi,
I'm trying to build a new QStyle where my Background will be transparent.
I tried this in my overridden polish(QPalette &palette)
palette.setBrush(QPalette::Window, Qt::transparent);
But I get a black background,
is there a different way to achieve transparency?
Thanks
Bye
Re: Transparent background Style
Use QWidget::setWindowOpacity() for top level widgets (requires a composite manager on X11). Child widgets are transparent by default in Qt 4.1.
Re: Transparent background Style
Hi, thanks for answering
well, after some more research I found this http://lists.trolltech.com/qt-intere...ad01463-0.html
which is exactly my problem, actually I'd like only some parts of my style will be transparent, not the entire window, and as stated in http://doc.trolltech.com/qq/qq16-background.html
"Qt 3.3 introduced a new widget property called windowOpacity for making top-level widgets (windows) transparent. This property can't be used to make child widgets semi-transparent, and it only works on window systems that support this feature (Mac OS X and Windows 2000 or later). In addition, the windowOpacity property applies to the widget as a whole, not to individual shapes or pixels."
So if I want a mainwindow(top level widget) with just the background transparent there's no way to achieve it?
thanks again
Re: Transparent background Style
I'm not 100% sure but yes, I believe there is no way to make only parts of a top level window transparent. Qt doesn't draw the top level window, it comes from the underlying system. Qt can only provide some hints to the platform what kind of window should it be (like transparent).
Re: Transparent background Style
Quote:
Originally Posted by Lele
I'd like only some parts of my style will be transparent, not the entire window
How about QWidget::setMask()?
Re: Transparent background Style
thanks,
well in my case I'd need all Background as tansparent, so not really a region but all the area
where the other widgets are attached.