Results 1 to 7 of 7

Thread: Fullscreen Transparent Windows

  1. #1
    Join Date
    Aug 2009
    Location
    Lancashire UK
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Fullscreen Transparent Windows

    Can anyone direct me to how to get points interactively from the desktop ? I have tried creating a parentless fullscreen window with setWindowOpacity(0.01), then tracking mouse events while echoing a QRubberBand crosshair or rectangle. This works great on Windows (XP/Vista) but does not work on X11, because the setWindowOpacity has no effect. Basically I need a system which will work on all systems (without the need for X compositing). I just need to get points interactively, and do not have to use transparent windows if there is another way. Any pointers would be greatly appreciated.

  2. #2
    Join Date
    Aug 2009
    Posts
    44
    Thanks
    29
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fullscreen Transparent Windows

    this topic is useful to me.

    /subscribed

  3. #3
    Join Date
    Sep 2008
    Posts
    18
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Fullscreen Transparent Windows

    My ideas:
    You can look at the source of the standard KDE color chooser widget (screenshot attached) -- when you click the pipette button it changes the cursor to crosshair and lets you click anywhere on screen to get the color of the clicked pixel. You could simply get just the positon. You can't "echo" the selected points directly, but it might be good enough.
    EDIT: actually, you could probably create tiny colored borderless always-on-top windows that would mark the selected pixels :-)

    Or you could (poorly) emulate transparency by displaying a snapshop of the desktop in your fullscreen window, then you can paint on it.
    Attached Images Attached Images
    Last edited by hkvm; 8th September 2009 at 20:08.

  4. #4
    Join Date
    Aug 2009
    Location
    Lancashire UK
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fullscreen Transparent Windows

    The workarounds people come up with always amaze me.
    I like the idea of the desktop snapshot to be used as a new window background, but sledgehammer and walnut also come to mind. Also what happens with a dual screen situation ? Don't tell me: 2 screenshots.

  5. #5
    Join Date
    Aug 2009
    Location
    Lancashire UK
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fullscreen Transparent Windows

    The KDE color chooser code does what was suggested. It takes a screengrab of the desktop, displays it in a fullscreen QLabel and then works on it from there. So if KDE can't do it without this sort of scam, who are we to quibble ? It also has the advantage of being a universal platform-independent solution.

  6. #6
    Join Date
    Sep 2008
    Posts
    18
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Fullscreen Transparent Windows

    You must have found some different code, the color picker has to do something more clever since the screen is updating normally even with video playing.

    I looked at the source and it actually seems to install an X11 event filter. That seems quite elegant, but of course not platform-independent... Oh well, it's your choice

    http://api.kde.org/4.0-api/kdelibs-a...pp-source.html
    (KDE3 version has slightly different code but seems like the same basic idea: http://mcs.une.edu.au/doc/kdelibs3-d...pp-source.html)
    Qt Code:
    1. void
    2. KColorDialog::KColorDialogPrivate::slotColorPicker()
    3. {
    4. bColorPicking = true;
    5. #ifdef Q_WS_X11
    6. filter = new KCDPickerFilter(q);
    7. kapp->installX11EventFilter(filter);
    8. #endif
    9. q->grabMouse( Qt::CrossCursor );
    10. q->grabKeyboard();
    11. }
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Aug 2009
    Location
    Lancashire UK
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Fullscreen Transparent Windows

    Yeah code I got hold of is completely different. I don't really want to be messing round with different code for different platforms if I can help it. Got the teeshirt etc. Thanks anyway.

Similar Threads

  1. How to set Qt window transparent?
    By montylee in forum Qt Programming
    Replies: 17
    Last Post: 24th December 2013, 20:11
  2. Replies: 5
    Last Post: 15th January 2009, 09:03
  3. Regarding drawing on Transparent Window
    By Shalabh in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2007, 10:32
  4. Transparent windows?
    By yogeshm02 in forum Qt Programming
    Replies: 13
    Last Post: 17th September 2006, 09:21
  5. Qt and windows vista
    By munna in forum General Discussion
    Replies: 8
    Last Post: 11th January 2006, 22:33

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.