Results 1 to 9 of 9

Thread: Geometry relative to desktop

  1. #1
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Geometry relative to desktop

    Hi all,

    I search a way to get the geometry of a widget relative to the desktop instead relative to the parent widget.
    Does anyone know how to do that?

    What I want to achieve is to grab the desktop and show my application maximized and put the desktop image in a graphics scene. That already works, but only if I remove window decoration. Since I want to keep it i have to move the grabbed image about the decorations size.

    Regards

  2. #2
    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: Geometry relative to desktop

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Geometry relative to desktop

    Thanks, that partly worked, but only of I use showMaximized(). If I use showFullScreen() instead (without removing windows decoration), mapToGlobal(QPoint(0,0)) retuns 0,0. Why?

    I now tried to first do showMaximized() followed by mapToGlobal() and then showFullScreen(), but this gives me some unwanted flicker.
    Last edited by thrall; 25th October 2010 at 20:06.

  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: Geometry relative to desktop

    Quote Originally Posted by thrall View Post
    mapToGlobal(QPoint(0,0)) retuns 0,0. Why?
    Because if you show a widget full screen then its 0,0 point corresponds to screen's 0,0 point.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Oct 2010
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Geometry relative to desktop

    I read your post several times and it's not clear what you're trying to do. Maybe this will help?

  6. #6
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Geometry relative to desktop

    Quote Originally Posted by wysota View Post
    Because if you show a widget full screen then its 0,0 point corresponds to screen's 0,0 point.
    Yes, that would be true, but the widget is not really full screen, there is still the window decoration around it, especially the title bar above it.

    Visually I have no difference between maximazied window and full screen window, thus I expected both to return same result, because the main widget occupies the same screen area in both cases.

  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: Geometry relative to desktop

    Quote Originally Posted by thrall View Post
    Yes, that would be true, but the widget is not really full screen, there is still the window decoration around it, especially the title bar above it.
    Then it's maximized rather than full screen. You are probably calling both methods.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Aug 2010
    Posts
    10
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Red face Re: Geometry relative to desktop

    Quote Originally Posted by wysota View Post
    Then it's maximized rather than full screen. You are probably calling both methods.
    Yes, you are right. It was a bit hidden in my code, but there was another showMaximized(). Thank you for your help .

    So I guess I can not have decoration for full screen window. Right?


    Added after 22 minutes:


    Quote Originally Posted by genjix View Post
    I read your post several times and it's not clear what you're trying to do. Maybe this will help?
    Thanks.

    What I already do is grabbing the desktop and showing it in my application at same position and size. What I was trying to achieve is having a full screen application with window decoration. Now I plan to add my own control at bottom or top of the screen. That could even look nicer than ordinary window decoration.

    Background: the task is rather simple. It's a little toy application for my son, which is 8 months old. He loves to play with our keyboard and mice, while we are working on computer. If that happens I can start my application which then lock all keyboard input (waiting for simple password to unlock or klick on unlock button). While the input is locked keystrokes are turned in some action (showing different pictures and sound, each et least for 1/2 second). That is already working and lot of fun for my son .
    (I know, there are already plenty of application doing the very same. But 1. I can not extend them and they did not have everything I wanted the way I wanted. And 2. its fun to program).
    Last edited by thrall; 25th October 2010 at 21:32.

  9. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,327
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Geometry relative to desktop

    Very nice application idea! I hope your son has some good fun using it. Maybe as he gets older you can make it more challenging - instead of just showing pictures and sounds for any keystroke, maybe he has to type some correct Qt code first. Then he could help you with your programming.

Similar Threads

  1. Relative paths in Qt
    By drmath in forum Qt Programming
    Replies: 2
    Last Post: 30th June 2010, 16:50
  2. relative file name
    By benlyboy in forum Newbie
    Replies: 3
    Last Post: 28th June 2010, 03:44
  3. relative position
    By franco.amato in forum Newbie
    Replies: 2
    Last Post: 8th December 2009, 18:08
  4. Replies: 5
    Last Post: 31st January 2009, 07:36
  5. Rubberband relative to QGraphicsScene
    By pherthyl in forum Qt Programming
    Replies: 25
    Last Post: 20th December 2007, 19:30

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.