Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to convert global coordinate to coordinate relative to parent?
Qt 6.12 LTS is out! See what's new in the release blog

How to convert global coordinate to coordinate relative to parent?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 7.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I think Qcursor::pos() give the global screen coordinates how can i convert it relative to parent coordinate.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      If you have a widget, you can call "QWidget::mapFromGlobal":http://doc.qt.nokia.com/4.7/qwidget.html#mapFromGlobal

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        [quote author="Gerolf" date="1321869156"]If you have a widget, you can call "QWidget::mapFromGlobal":http://doc.qt.nokia.com/4.7/qwidget.html#mapFromGlobal[/quote]

        thanks

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt
        • Unsolved