PDA

View Full Version : Transparent windows?



yogeshm02
10th September 2006, 17:22
Hi

I want to have my Qt app's window be partially opaque, just like Qt does it for widgets (using backing-store?). Can this be done/implemented in a future Qt release?
If not, how can I, with minimum amount of additional code, achieve the same using X directly?

I want it for displaying shadows on (non-rectangular) windows and other similar eye-candy stuff.
Like in http://www.linuxlots.com/~siraj/qtclock.html, which stops working as soon as compmgr is turned off. May be, there is some loop-hole left in the application, but having no experience with xrender and without any documentation, I can't figure it out.

Waiting for your help...

Brandybuck
10th September 2006, 17:34
Take a look at this article. It may help. http://doc.trolltech.com/qq/qq16-background.html

yogeshm02
11th September 2006, 13:57
No, I want my app's window to have some partially opaque parts and, hence, show the content beneath that window (probably desktop or some other window).
The article has no solution to that.

Please help because I'm trying this for a long time.

wysota
11th September 2006, 14:15
QWidget::setMask() may be able to help you, it doesn't use the composite capabilities of your graphical backend. It won't help you to achieve semi-transparency, though. You'll need composite for that (or you'll have to "emulate" it, which will be very inefficient).

yogeshm02
11th September 2006, 14:25
Composite is what I am thinking, since months, I need. But owing to no documentation (at I could not find) I am unable to use it. Also I am pretty my uninformed about what exactly needs to be done for the task on hand.

yogeshm02
11th September 2006, 14:39
Somewhere in my is this idea: Use composite for a screenshot of each window and blend with my window.
This, for me, is very ugly idea (and perhaps would be slow), but I've no idea of how composite functions or what it can do or not.

wysota
11th September 2006, 14:55
AFAIK composite works as described in the article already pointed in one of the previous posts in this thread. Search Google for composite+extension+x11+api, maybe something usefull will pop up.

pherthyl
11th September 2006, 21:24
QWidget::setWindowOpacity(qreal)

Or am I misunderstanding your question? That function will set your window partially transparent (provided composite is working).

wysota
11th September 2006, 21:40
QWidget::setWindowOpacity(qreal)

Or am I misunderstanding your question? That function will set your window partially transparent (provided composite is working).

It won't work for X11 and additionally it changes the opacity of the whole window, not parts of it.

pherthyl
11th September 2006, 23:06
It won't work for X11 and additionally it changes the opacity of the whole window, not parts of it.

Indeed. But you won't get around the requirement for composite no matter what you do (unless you just want to mask, or use some very ugly screenshot hacks).

However, at one point I remember zack rusin (Trolltech and KDE dev) releasing a short video showing what the SVG engine in Qt is capable of. In this video, he had a toplevel widget, defined in SVG, that was partially transparent (but only parts of it) and could add standard widgets on it. Now I can't find this video anymore, but it seems that it should be possible to do what the original poster wanted in this way.

pherthyl
11th September 2006, 23:13
Found it:

http://www.kdedevelopers.org/node/1559

It seems this should be possible right now? I'll have to try and get back to you.

Update: Can't get it working here (4.1.3, Windows XP). I emailed Zack about it, see if he can provide any details.

yogeshm02
13th September 2006, 15:20
Found it:

http://www.kdedevelopers.org/node/1559


This is exactly what I want! Looks too easy.:)


Update: Can't get it working here (4.1.3, Windows XP). I emailed Zack about it, see if he can provide any details.
My initial attempt has also failed. I'll try different combinations and report if done. :cool:

pherthyl
13th September 2006, 20:41
No success here. I can't get it to work, and I haven't heard anything from Zack. I suspect this feature either never made it into Qt, or didn't make it until 4.2, or didn't make it into the Windows version at all.

yogeshm02
17th September 2006, 09:21
Like in http://www.linuxlots.com/~siraj/qtclock.html, which stops working as soon as compmgr is turned off. May be, there is some loop-hole left in the application, but having no experience with xrender and without any documentation, I can't figure it out.

Solved that. I'd ARGB visuals disabled in kompmgr.



No success here. I can't get it to work, and I haven't heard anything from Zack. I suspect this feature either never made it into Qt, or didn't make it until 4.2, or didn't make it into the Windows version at all.
Native ARGB support is still pending; I'll, at best, be available with 4.3 (may be by then composite support will be very stable and fast in Xorg) http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=120338

Till then I'll have to you use ARGB visuals on my own, qtclock serves good here, even if I can't understand the logic behind its functioning. :o

Bye...

Update: Forgot to mention that using ARGB visuals is enough for my needs.