Bläddra i källkod

Fix OptionButton docs godotengine#36803

* item_selected and item_focused docs incorrectly had 'id' as the parameter. Changed to
'index'.
* Fix parameter name in ADD_SIGNAL callin code.

(cherry picked from commit a8de034f78198ba13fa7455d78e2ca31bb8b9f5f)
Zak Grumbles 5 år sedan
förälder
incheckning
5d9108c9c6
2 ändrade filer med 4 tillägg och 4 borttagningar
  1. 2 2
      doc/classes/OptionButton.xml
  2. 2 2
      scene/gui/option_button.cpp

+ 2 - 2
doc/classes/OptionButton.xml

@@ -214,14 +214,14 @@
 	</members>
 	</members>
 	<signals>
 	<signals>
 		<signal name="item_focused">
 		<signal name="item_focused">
-			<argument index="0" name="id" type="int">
+			<argument index="0" name="index" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Emitted the when user navigates to an item using the [code]ui_up[/code] or [code]ui_down[/code] actions. The index of the item selected is passed as argument.
 				Emitted the when user navigates to an item using the [code]ui_up[/code] or [code]ui_down[/code] actions. The index of the item selected is passed as argument.
 			</description>
 			</description>
 		</signal>
 		</signal>
 		<signal name="item_selected">
 		<signal name="item_selected">
-			<argument index="0" name="id" type="int">
+			<argument index="0" name="index" type="int">
 			</argument>
 			</argument>
 			<description>
 			<description>
 				Emitted when the current item has been changed by the user. The index of the item selected is passed as argument.
 				Emitted when the current item has been changed by the user. The index of the item selected is passed as argument.

+ 2 - 2
scene/gui/option_button.cpp

@@ -343,8 +343,8 @@ void OptionButton::_bind_methods() {
 	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
 	ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "items", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "_set_items", "_get_items");
 	// "selected" property must come after "items", otherwise GH-10213 occurs.
 	// "selected" property must come after "items", otherwise GH-10213 occurs.
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
 	ADD_PROPERTY(PropertyInfo(Variant::INT, "selected"), "_select_int", "get_selected");
-	ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "id")));
-	ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "id")));
+	ADD_SIGNAL(MethodInfo("item_selected", PropertyInfo(Variant::INT, "index")));
+	ADD_SIGNAL(MethodInfo("item_focused", PropertyInfo(Variant::INT, "index")));
 }
 }
 
 
 OptionButton::OptionButton() {
 OptionButton::OptionButton() {