Jelajahi Sumber

Merge pull request #42376 from Calinou/editorspinslider-comma-decimal

Allow using a comma as decimal separator in EditorSpinSlider
Rémi Verschelde 5 tahun lalu
induk
melakukan
82d1265185
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      editor/editor_spin_slider.cpp

+ 6 - 1
editor/editor_spin_slider.cpp

@@ -356,7 +356,12 @@ String EditorSpinSlider::get_label() const {
 }
 
 void EditorSpinSlider::_evaluate_input_text() {
-	String text = value_input->get_text();
+	// Replace comma with dot to support it as decimal separator (GH-6028).
+	// This prevents using functions like `pow()`, but using functions
+	// in EditorSpinSlider is a barely known (and barely used) feature.
+	// Instead, we'd rather support German/French keyboard layouts out of the box.
+	const String text = value_input->get_text().replace(",", ".");
+
 	Ref<Expression> expr;
 	expr.instance();
 	Error err = expr->parse(text);