Unable to map QCursor::pos() to widget coordinates
-
Hey
I'm struggling to map my cursor to widget coordinates to detect when user move it over the window. When I run a test I get this :
qDebug() << view->isVisible() << view->geometry().contains(view->mapFromGlobal(QCursor::pos())) << QCursor::pos() << view->mapFromGlobal(QCursor::pos()) << view->geometry();
true false QPoint(527,121) QPoint(73,69) QRect(454,29 2986x1362)
The mouse is in left-upper corner of widget, the second QPoint() coordinate remain valid. But when I do contains() on geometry it returns fals after mapping...
How can I properly do this test?TIA
-
Hi
What is View ? -
Hi,
Can you tell us what you want to do with when your mouse goes over that widget ?
-
@SGaist said in Unable to map QCursor::pos() to widget coordinates:
Hi,
Can you tell us what you want to do with when your mouse goes over that widget ?
I have eventFilter installed n qApp, when user press a key, I emit that in a signal, and any widget that is interested in that key, checks if at the time mouse is over it and then acts properly. It seems to be a "hiccup" with qopenglwindow, treeviews appear to work fine.
-
Then please provide a minimal compilable example that shows the behaviour.