diff options
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/line_edit.cpp | 8 | ||||
-rw-r--r-- | scene/gui/line_edit.h | 6 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 7 | ||||
-rw-r--r-- | scene/gui/rich_text_label.h | 5 |
4 files changed, 20 insertions, 6 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index ba08aae8e3..fda543aa36 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1135,6 +1135,8 @@ void LineEdit::cursor_set_blink_enabled(const bool p_enabled) { } draw_caret = true; + + notify_property_list_changed(); } bool LineEdit::cursor_get_force_displayed() const { @@ -2056,6 +2058,12 @@ void LineEdit::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::NIL, "opentype_features/_new", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR)); } +void LineEdit::_validate_property(PropertyInfo &property) const { + if (!caret_blink_enabled && property.name == "caret_blink_speed") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} + void LineEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_text_changed"), &LineEdit::_text_changed); diff --git a/scene/gui/line_edit.h b/scene/gui/line_edit.h index cbadf818cd..f5d616d078 100644 --- a/scene/gui/line_edit.h +++ b/scene/gui/line_edit.h @@ -197,15 +197,15 @@ private: void _backspace(bool p_word = false, bool p_all_to_left = false); void _delete(bool p_word = false, bool p_all_to_right = false); - void _gui_input(Ref<InputEvent> p_event); - void _notification(int p_what); - protected: + void _notification(int p_what); static void _bind_methods(); + void _gui_input(Ref<InputEvent> p_event); bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; void _get_property_list(List<PropertyInfo> *p_list) const; + void _validate_property(PropertyInfo &property) const override; public: void set_align(Align p_align); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 682584d73f..ed319f9fd0 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -3634,6 +3634,7 @@ void RichTextLabel::set_use_bbcode(bool p_enable) { } use_bbcode = p_enable; set_bbcode(bbcode); + notify_property_list_changed(); } bool RichTextLabel::is_using_bbcode() const { @@ -3771,6 +3772,12 @@ int RichTextLabel::get_content_height() const { return total_height; } +void RichTextLabel::_validate_property(PropertyInfo &property) const { + if (!use_bbcode && property.name == "bbcode_text") { + property.usage = PROPERTY_USAGE_NOEDITOR; + } +} + void RichTextLabel::_bind_methods() { ClassDB::bind_method(D_METHOD("_gui_input"), &RichTextLabel::_gui_input); ClassDB::bind_method(D_METHOD("get_text"), &RichTextLabel::get_text); diff --git a/scene/gui/rich_text_label.h b/scene/gui/rich_text_label.h index 2351aff0a4..e3e457d1f2 100644 --- a/scene/gui/rich_text_label.h +++ b/scene/gui/rich_text_label.h @@ -81,7 +81,9 @@ public: }; protected: + void _notification(int p_what); static void _bind_methods(); + void _validate_property(PropertyInfo &property) const override; private: struct Item; @@ -441,9 +443,6 @@ private: bool fit_content_height = false; -protected: - void _notification(int p_what); - public: String get_text(); void add_text(const String &p_text); |