Add apply method to SpinBox

This commit is contained in:
Jóhannes Gunnar Þorsteinsson 2020-01-09 13:44:23 +00:00
parent e97e951741
commit 083637a901
3 changed files with 14 additions and 0 deletions

View file

@ -26,6 +26,13 @@
Returns the [LineEdit] instance from this [SpinBox]. You can use it to access properties and methods of [LineEdit]. Returns the [LineEdit] instance from this [SpinBox]. You can use it to access properties and methods of [LineEdit].
</description> </description>
</method> </method>
<method name="apply">
<return type="void">
</return>
<description>
Applies the current value of this [SpinBox].
</description>
</method>
</methods> </methods>
<members> <members>
<member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0"> <member name="align" type="int" setter="set_align" getter="get_align" enum="LineEdit.Align" default="0">

View file

@ -259,6 +259,10 @@ bool SpinBox::is_editable() const {
return line_edit->is_editable(); return line_edit->is_editable();
} }
void SpinBox::apply() {
_text_entered(line_edit->get_text());
}
void SpinBox::_bind_methods() { void SpinBox::_bind_methods() {
//ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed); //ClassDB::bind_method(D_METHOD("_value_changed"),&SpinBox::_value_changed);
@ -272,6 +276,7 @@ void SpinBox::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_prefix"), &SpinBox::get_prefix); ClassDB::bind_method(D_METHOD("get_prefix"), &SpinBox::get_prefix);
ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable); ClassDB::bind_method(D_METHOD("set_editable", "editable"), &SpinBox::set_editable);
ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable); ClassDB::bind_method(D_METHOD("is_editable"), &SpinBox::is_editable);
ClassDB::bind_method(D_METHOD("apply"), &SpinBox::apply);
ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit); ClassDB::bind_method(D_METHOD("_line_edit_focus_exit"), &SpinBox::_line_edit_focus_exit);
ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit); ClassDB::bind_method(D_METHOD("get_line_edit"), &SpinBox::get_line_edit);
ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input); ClassDB::bind_method(D_METHOD("_line_edit_input"), &SpinBox::_line_edit_input);

View file

@ -88,6 +88,8 @@ public:
void set_prefix(const String &p_prefix); void set_prefix(const String &p_prefix);
String get_prefix() const; String get_prefix() const;
void apply();
SpinBox(); SpinBox();
}; };