diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml
index 196921ddbfc..3f3b96708b1 100644
--- a/doc/classes/AcceptDialog.xml
+++ b/doc/classes/AcceptDialog.xml
@@ -21,6 +21,7 @@
Adds a button with label [code]text[/code] and a custom [code]action[/code] to the dialog and returns the created button. [code]action[/code] will be passed to the [signal custom_action] signal when pressed.
If [code]true[/code], [code]right[/code] will place the button to the right of any sibling buttons.
+ You can use [method remove_button] method to remove a button created with this method from the dialog.
@@ -30,6 +31,7 @@
Adds a button with label [code]name[/code] and a cancel action to the dialog and returns the created button.
+ You can use [method remove_button] method to remove a button created with this method from the dialog.
@@ -55,6 +57,15 @@
Registers a [LineEdit] in the dialog. When the enter key is pressed, the dialog will be accepted.
+
+
+
+
+
+
+ Removes the [code]button[/code] from the dialog. Does NOT free the [code]button[/code]. The [code]button[/code] must be a [Button] added with [method add_button] or [method add_cancel] method. After removal, pressing the [code]button[/code] will no longer emit this dialog's [signal custom_action] signal or cancel this dialog.
+
+
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index f987c6bb843..347e24eecda 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -529,6 +529,28 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) {
return b;
}
+void AcceptDialog::remove_button(Control *p_button) {
+ Button *button = Object::cast_to