mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
176 lines
10 KiB
ReStructuredText
176 lines
10 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Signal.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Signal:
|
|
|
|
Signal
|
|
======
|
|
|
|
Class representing a signal defined in an object.
|
|
|
|
Methods
|
|
-------
|
|
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Signal<class_Signal>` | :ref:`Signal<class_Signal_method_Signal>` **(** **)** |constructor| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Signal<class_Signal>` | :ref:`Signal<class_Signal_method_Signal>` **(** :ref:`Signal<class_Signal>` from **)** |constructor| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Signal<class_Signal>` | :ref:`Signal<class_Signal_method_Signal>` **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` signal **)** |constructor| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`connect<class_Signal_method_connect>` **(** :ref:`Callable<class_Callable>` callable, :ref:`int<class_int>` flags=0 **)** |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`disconnect<class_Signal_method_disconnect>` **(** :ref:`Callable<class_Callable>` callable **)** |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`emit<class_Signal_method_emit>` **(** ... **)** |vararg| |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Array<class_Array>` | :ref:`get_connections<class_Signal_method_get_connections>` **(** **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`get_name<class_Signal_method_get_name>` **(** **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Object<class_Object>` | :ref:`get_object<class_Signal_method_get_object>` **(** **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`get_object_id<class_Signal_method_get_object_id>` **(** **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_connected<class_Signal_method_is_connected>` **(** :ref:`Callable<class_Callable>` callable **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`is_null<class_Signal_method_is_null>` **(** **)** |const| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | **operator !=** **(** **)** |operator| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | **operator !=** **(** :ref:`Signal<class_Signal>` right **)** |operator| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | **operator ==** **(** **)** |operator| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | **operator ==** **(** :ref:`Signal<class_Signal>` right **)** |operator| |
|
|
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_Signal_method_Signal:
|
|
|
|
- :ref:`Signal<class_Signal>` **Signal** **(** **)** |constructor|
|
|
|
|
Constructs a null ``Signal`` with no object nor signal name bound.
|
|
|
|
----
|
|
|
|
- :ref:`Signal<class_Signal>` **Signal** **(** :ref:`Signal<class_Signal>` from **)** |constructor|
|
|
|
|
Constructs a ``Signal`` as a copy of the given ``Signal``.
|
|
|
|
----
|
|
|
|
- :ref:`Signal<class_Signal>` **Signal** **(** :ref:`Object<class_Object>` object, :ref:`StringName<class_StringName>` signal **)** |constructor|
|
|
|
|
Creates a new ``Signal`` with the name ``signal`` in the specified ``object``.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_connect:
|
|
|
|
- :ref:`int<class_int>` **connect** **(** :ref:`Callable<class_Callable>` callable, :ref:`int<class_int>` flags=0 **)**
|
|
|
|
Connects this signal to the specified :ref:`Callable<class_Callable>`, optionally providing connection flags. You can provide additional arguments to the connected method call by using :ref:`Callable.bind<class_Callable_method_bind>`.
|
|
|
|
::
|
|
|
|
for button in $Buttons.get_children():
|
|
button.pressed.connect(on_pressed.bind(button))
|
|
|
|
func on_pressed(button):
|
|
print(button.name, " was pressed")
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_disconnect:
|
|
|
|
- void **disconnect** **(** :ref:`Callable<class_Callable>` callable **)**
|
|
|
|
Disconnects this signal from the specified :ref:`Callable<class_Callable>`.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_emit:
|
|
|
|
- void **emit** **(** ... **)** |vararg| |const|
|
|
|
|
Emits this signal to all connected objects.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_get_connections:
|
|
|
|
- :ref:`Array<class_Array>` **get_connections** **(** **)** |const|
|
|
|
|
Returns the list of :ref:`Callable<class_Callable>`\ s connected to this signal.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_get_name:
|
|
|
|
- :ref:`StringName<class_StringName>` **get_name** **(** **)** |const|
|
|
|
|
Returns the name of this signal.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_get_object:
|
|
|
|
- :ref:`Object<class_Object>` **get_object** **(** **)** |const|
|
|
|
|
Returns the object emitting this signal.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_get_object_id:
|
|
|
|
- :ref:`int<class_int>` **get_object_id** **(** **)** |const|
|
|
|
|
Returns the ID of the object emitting this signal (see :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`).
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_is_connected:
|
|
|
|
- :ref:`bool<class_bool>` **is_connected** **(** :ref:`Callable<class_Callable>` callable **)** |const|
|
|
|
|
Returns ``true`` if the specified :ref:`Callable<class_Callable>` is connected to this signal.
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_is_null:
|
|
|
|
- :ref:`bool<class_bool>` **is_null** **(** **)** |const|
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_operator !=:
|
|
|
|
- :ref:`bool<class_bool>` **operator !=** **(** **)** |operator|
|
|
|
|
----
|
|
|
|
- :ref:`bool<class_bool>` **operator !=** **(** :ref:`Signal<class_Signal>` right **)** |operator|
|
|
|
|
----
|
|
|
|
.. _class_Signal_method_operator ==:
|
|
|
|
- :ref:`bool<class_bool>` **operator ==** **(** **)** |operator|
|
|
|
|
----
|
|
|
|
- :ref:`bool<class_bool>` **operator ==** **(** :ref:`Signal<class_Signal>` right **)** |operator|
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|