I am a bit new to QT. I have a separate Crosshair
class that simply renders a crosshair using the QPainter
and QPen
. I used the paint()
function and it does display the crosshairs at some position in the window. How can make the crosshairs follow the current mouse position?
This is my approach but I can't get it to work. I was following the VoidRealms tutorial.
void Crosshair::mouseMoveEvent(QGraphicsSceneMouseEvent *event){
// i want to update the x and y position when the mouse moves
//x = mouse.x
//y = mouse.y
QGraphicsItem::mouseMoveEvent(event);
update();
}