Results 1 to 2 of 2

Thread: X and Y position of QWidget

  1. #1
    Join Date
    Sep 2006
    Posts
    19
    Thanks
    12

    Default X and Y position of QWidget

    Hi

    I'm trying to find x and y coordinate of a combobox. On the following picture I would like to find the length (x-coordinate) of the red line. When I call x() on the combobox it returns the length of the blue line.

    example.png

    Do I have to go though all the parents to find the coordinate (length of the red line)?

    -- Bjoern

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: X and Y position of QWidget

    use QWidget::mapTo() method with the widget argument being your main window.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

Similar Threads

  1. QtScript Binding problem with QWidget
    By zack in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 09:38
  2. Replies: 0
    Last Post: 11th November 2008, 15:36
  3. Dynamic updates of a QWidget in a QScrollArea
    By plamkata in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2008, 23:45
  4. Error in put one QWidget in another QWidget
    By xjtu in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2008, 16:05
  5. Replies: 3
    Last Post: 8th March 2007, 14:54

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.