diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/line_edit.cpp | 23 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 4 |
2 files changed, 26 insertions, 1 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index b9b8b7fda0..fc5e82d36a 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -31,6 +31,9 @@ #include "os/os.h" #include "print_string.h" #include "label.h" +#ifdef TOOLS_ENABLED +#include "tools/editor/editor_settings.h" +#endif static bool _is_text_char(CharType c) { @@ -544,7 +547,16 @@ void LineEdit::drop_data(const Point2& p_point,const Variant& p_data){ void LineEdit::_notification(int p_what) { switch(p_what) { +#ifdef TOOLS_ENABLED + case NOTIFICATION_ENTER_TREE: { + if (get_tree()->is_editor_hint()) { + cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false)); + cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65)); + EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); + } + } break; +#endif case NOTIFICATION_RESIZED: { set_cursor_pos( get_cursor_pos() ); @@ -1185,10 +1197,21 @@ PopupMenu *LineEdit::get_menu() const { return menu; } +#ifdef TOOLS_ENABLED + void LineEdit::_editor_settings_changed() { + cursor_set_blink_enabled(EDITOR_DEF("text_editor/caret_blink", false)); + cursor_set_blink_speed(EDITOR_DEF("text_editor/caret_blink_speed", 0.65)); + } +#endif + void LineEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("_toggle_draw_caret"),&LineEdit::_toggle_draw_caret); +#ifdef TOOLS_ENABLED + ObjectTypeDB::bind_method("_editor_settings_changed",&LineEdit::_editor_settings_changed); +#endif + ObjectTypeDB::bind_method(_MD("set_align", "align"), &LineEdit::set_align); ObjectTypeDB::bind_method(_MD("get_align"), &LineEdit::get_align); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index e458c47ff4..e4da0f0b87 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -108,7 +108,9 @@ private: void clear_internal(); void changed_internal(); - +#ifdef TOOLS_ENABLED + void _editor_settings_changed(); +#endif void _input_event(InputEvent p_event); void _notification(int p_what); |