Qt 5, get the mouse position in a screen

前端 未结 6 1327
难免孤独
难免孤独 2020-12-17 10:37

First of all, I\'d like to mention that I found that related post How to get the mouse position on the screen in Qt? but it \"just didn\'t work\" for me. I made some tests,

6条回答
  •  眼角桃花
    2020-12-17 10:59

    This may work for you? It did for me

    QDesktopWidget *widget = QApplication::desktop(); QPosition globalCursorPosition = widget->cursor().pos();

提交回复
热议问题