protected override void MousePressEvent(QMouseEvent e) { if (e.Button() != Qt.MouseButton.LeftButton) return; if (BarrelHit(e.Pos())) barrelPressed = true; }
protected override void MouseMoveEvent(QMouseEvent e) { if (!barrelPressed) return; QPoint pos = e.Pos(); if (pos.X() <= 0) pos.SetX(1); if (pos.Y() >= Height()) pos.SetY(Height() - 1); double rad = Math.Atan(((double)Rect.Bottom() - pos.Y()) / pos.X()); SetAngle((int) Math.Round(rad * 180 / 3.14159265)); }