-Added a "modal_close" signal for controls
-Used it to keep changes on lineedit when focused out
This commit is contained in:
parent
9743bc32be
commit
5a1593951b
@ -509,6 +509,10 @@ void Control::_notification(int p_notification) {
|
|||||||
|
|
||||||
update();
|
update();
|
||||||
} break;
|
} break;
|
||||||
|
case NOTIFICATION_MODAL_CLOSE: {
|
||||||
|
|
||||||
|
emit_signal("modal_close");
|
||||||
|
} break;
|
||||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||||
|
|
||||||
if (!is_visible()) {
|
if (!is_visible()) {
|
||||||
@ -2246,6 +2250,7 @@ void Control::_bind_methods() {
|
|||||||
ADD_SIGNAL( MethodInfo("focus_exit") );
|
ADD_SIGNAL( MethodInfo("focus_exit") );
|
||||||
ADD_SIGNAL( MethodInfo("size_flags_changed") );
|
ADD_SIGNAL( MethodInfo("size_flags_changed") );
|
||||||
ADD_SIGNAL( MethodInfo("minimum_size_changed") );
|
ADD_SIGNAL( MethodInfo("minimum_size_changed") );
|
||||||
|
ADD_SIGNAL( MethodInfo("modal_close") );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1721,6 +1721,20 @@ int Tree::propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Tree::_text_editor_modal_close() {
|
||||||
|
|
||||||
|
if ( Input::get_singleton()->is_key_pressed(KEY_ESCAPE) ||
|
||||||
|
Input::get_singleton()->is_key_pressed(KEY_ENTER) ||
|
||||||
|
Input::get_singleton()->is_key_pressed(KEY_RETURN) ) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
text_editor_enter(text_editor->get_text());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Tree::text_editor_enter(String p_text) {
|
void Tree::text_editor_enter(String p_text) {
|
||||||
|
|
||||||
|
|
||||||
@ -3185,6 +3199,7 @@ void Tree::_bind_methods() {
|
|||||||
ObjectTypeDB::bind_method(_MD("_input_event"),&Tree::_input_event);
|
ObjectTypeDB::bind_method(_MD("_input_event"),&Tree::_input_event);
|
||||||
ObjectTypeDB::bind_method(_MD("_popup_select"),&Tree::popup_select);
|
ObjectTypeDB::bind_method(_MD("_popup_select"),&Tree::popup_select);
|
||||||
ObjectTypeDB::bind_method(_MD("_text_editor_enter"),&Tree::text_editor_enter);
|
ObjectTypeDB::bind_method(_MD("_text_editor_enter"),&Tree::text_editor_enter);
|
||||||
|
ObjectTypeDB::bind_method(_MD("_text_editor_modal_close"),&Tree::_text_editor_modal_close);
|
||||||
ObjectTypeDB::bind_method(_MD("_value_editor_changed"),&Tree::value_editor_changed);
|
ObjectTypeDB::bind_method(_MD("_value_editor_changed"),&Tree::value_editor_changed);
|
||||||
ObjectTypeDB::bind_method(_MD("_scroll_moved"),&Tree::_scroll_moved);
|
ObjectTypeDB::bind_method(_MD("_scroll_moved"),&Tree::_scroll_moved);
|
||||||
|
|
||||||
@ -3283,6 +3298,7 @@ Tree::Tree() {
|
|||||||
h_scroll->connect("value_changed", this,"_scroll_moved");
|
h_scroll->connect("value_changed", this,"_scroll_moved");
|
||||||
v_scroll->connect("value_changed", this,"_scroll_moved");
|
v_scroll->connect("value_changed", this,"_scroll_moved");
|
||||||
text_editor->connect("text_entered", this,"_text_editor_enter");
|
text_editor->connect("text_entered", this,"_text_editor_enter");
|
||||||
|
text_editor->connect("modal_close", this,"_text_editor_modal_close");
|
||||||
popup_menu->connect("item_pressed", this,"_popup_select");
|
popup_menu->connect("item_pressed", this,"_popup_select");
|
||||||
value_editor->connect("value_changed", this,"_value_editor_changed");
|
value_editor->connect("value_changed", this,"_value_editor_changed");
|
||||||
|
|
||||||
|
@ -314,6 +314,7 @@ friend class TreeItem;
|
|||||||
void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL);
|
void select_single_item(TreeItem *p_selected,TreeItem *p_current,int p_col,TreeItem *p_prev=NULL,bool *r_in_range=NULL);
|
||||||
int propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_doubleclick,TreeItem *p_item,int p_button,const InputModifierState& p_mod);
|
int propagate_mouse_event(const Point2i &p_pos,int x_ofs,int y_ofs,bool p_doubleclick,TreeItem *p_item,int p_button,const InputModifierState& p_mod);
|
||||||
void text_editor_enter(String p_text);
|
void text_editor_enter(String p_text);
|
||||||
|
void _text_editor_modal_close();
|
||||||
void value_editor_changed(double p_value);
|
void value_editor_changed(double p_value);
|
||||||
|
|
||||||
void popup_select(int p_option);
|
void popup_select(int p_option);
|
||||||
|
Loading…
Reference in New Issue
Block a user