Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Mapping cursor coordinate between QMainWindow and Screen
Qt 6.11 is out! See what's new in the release blog

Mapping cursor coordinate between QMainWindow and Screen

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 868 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.
  • A Offline
    A Offline
    AlbertYang
    wrote on last edited by
    #1

    Hi All,

    I've met a problem while mapping cursor coordinates between QMainWindow and Screen.

    When I maximized the window and move the cursor to the upper border of current window, I got the global cursor coordinate: (x, 0). After I called the QWidget::MapFromGlobal(), I got the local cursor coordinate: (x, 16). I suppose the y coordinate should also be "0"!

    When the window is not maximized, I move the window so that the upper border align with upper screen, and could get the mapped coordinate I supposed. That is, the mapped local cursor coordinate is: (x, 0).

    Could any one tell me why the cursor coordinate mapping mechanism is different while the window is maximized and normal. Thanks in advance!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AlbertYang
      wrote on last edited by
      #2

      No one can tell me reason? Or, if the problem is confusing, I can re-explain it.

      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 Extensions
      • Unsolved