X and Y mouse position
Unsolved
General and Desktop
-
Hi, i have a problem,
I need x and y mouse position, bat this code doesn't work:
void MainWindow::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::RightButton)
{
pan_x = event->x();
pan_y = event->y();
}
}
Practically, i have a function ''mousePressEvent" with 'QMouseEvent *event' parameter, the function controll if the event is a right click mouse, in that case, it should, set 'pan_x' to value of x mouse position and 'pan_y' to value of y mouse position.
In any case, it generates these error:
Other information:
- I use 6.1.2 version of QT
- I have already included: '<QMouseEvent>'
-
I don't see errors, just deprecation warnings. And there is also a hint on how to fix them.
-
The error message says it's all - use QMouseEvent::position() instead.