Results 1 to 14 of 14

Thread: Transparent windows?

  1. #1
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Transparent windows?

    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...

  2. #2
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Transparent windows?

    Take a look at this article. It may help. http://doc.trolltech.com/qq/qq16-background.html

  3. #3
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Transparent windows?

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Transparent windows?

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

  5. #5
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Transparent windows?

    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.

  6. #6
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Transparent windows?

    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.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Transparent windows?

    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.

  8. #8
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Transparent windows?

    QWidget::setWindowOpacity(qreal)

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

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Transparent windows?

    Quote Originally Posted by pherthyl
    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.

  10. #10
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Transparent windows?

    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.

  11. #11
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Transparent windows?

    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.
    Last edited by pherthyl; 12th September 2006 at 00:39.

  12. The following user says thank you to pherthyl for this useful post:

    yogeshm02 (13th September 2006)

  13. #12
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Transparent windows?

    Quote Originally Posted by pherthyl
    This is exactly what I want! Looks too easy.

    Quote Originally Posted by pherthyl
    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.

  14. #13
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Transparent windows?

    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.

  15. #14
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Lightbulb Re: Transparent windows?

    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/t...ntry&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.

    Bye...

    Update: Forgot to mention that using ARGB visuals is enough for my needs.
    Last edited by yogeshm02; 17th September 2006 at 09:29.

Similar Threads

  1. Replies: 3
    Last Post: 8th December 2006, 18:51
  2. Replies: 2
    Last Post: 30th August 2006, 10:09
  3. qt and mingw can not run on windows 98?
    By evewei in forum Installation and Deployment
    Replies: 4
    Last Post: 26th June 2006, 09:22
  4. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15
  5. Replies: 4
    Last Post: 12th January 2006, 04:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.