Results 1 to 2 of 2

Thread: Getting a widget's position in desktop coords?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Getting a widget's position in desktop coords?

    I'm trying to display a popup that appears relative to the button that opens it, and not be constrained by the window of the button's parent. And it seems that to set the popup dialog position (via QWidget::move()), I have to specify it in desktop coordinates. But I can't seem to find an easy way to find the geometry of the button in desktop coordinates; QWidget:: pos() returns relative coords to the parent.

    The best I can do is QCursor:: pos(), but that's just the mouse cursor, not the button. Do I have to just traverse up all the parents, and add up the relative positions of the widgets to their parents, until I hit a toplevel window widget (which should have pos() returning desktop coords)?
    Last edited by gfunk; 5th January 2007 at 00:29.
    Software Engineer



Similar Threads

  1. Replies: 11
    Last Post: 7th July 2006, 13:09
  2. Creating Widgets
    By hylke in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2006, 08:37

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.