Important: Please read the Qt Code of Conduct -

Mapping cursor coordinate between QMainWindow and Screen

  • 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!

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

Log in to reply