public void SetAngle(int angle) { if (angle < 5) { angle = 5; } if (angle > 70) { angle = 70; } if (currentAngle == angle) { return; } currentAngle = angle; QRect cr = CannonRect; Update(cr.X(),cr.Y(),cr.Width(),cr.Height()); Emit.AngleChanged(currentAngle); }
public static void CenterWidgetOnScreen(QWidget widget) { QRect rect = QApplication.Desktop().AvailableGeometry(widget); widget.Move((rect.Width() / 2) - (widget.Rect.Width() / 2), (rect.Height() / 2) - (widget.Rect.Height() / 2)); }