私はQTに少し慣れていません。Crosshair
とを使用して十字線を単純にレンダリングする別のクラスがQPainter
ありQPen
ます。この機能を使用したpaint()
ところ、ウィンドウ内のある位置に十字線が表示されました。十字線を現在のマウス位置に追従させるにはどうすればよいですか?
これは私のアプローチですが、うまくいきません。私は VoidRealms チュートリアルに従っていました。
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();
}