diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-07-01 08:47:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 08:47:22 +0200 |
commit | 3758981bd4aa09a7aec5f2bc496c3852ed07b08f (patch) | |
tree | 6a80f02c2ecff6d6bcbdfd07d2fe21d904e7ed7e /scene/gui | |
parent | 4f79812d41a2aa8d3329543ec0f223be1ec1132f (diff) | |
parent | a0cc62f0003ea9204c44fdbb32ea12b723b150e7 (diff) |
Merge pull request #30161 from Calinou/add-tooltip-mouse-filter-warning
Add a configuration warning when using Ignore mouse filter with tooltip
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/control.cpp | 16 | ||||
-rw-r--r-- | scene/gui/control.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 6e0e26312f..eccd42cb9f 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -2249,6 +2249,7 @@ Ref<Theme> Control::get_theme() const { void Control::set_tooltip(const String &p_tooltip) { data.tooltip = p_tooltip; + update_configuration_warning(); } String Control::get_tooltip(const Point2 &p_pos) const { @@ -2540,6 +2541,7 @@ void Control::set_mouse_filter(MouseFilter p_filter) { ERR_FAIL_INDEX(p_filter, 3); data.mouse_filter = p_filter; + update_configuration_warning(); } Control::MouseFilter Control::get_mouse_filter() const { @@ -2703,6 +2705,20 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List } } } + +String Control::get_configuration_warning() const { + String warning = CanvasItem::get_configuration_warning(); + + if (data.mouse_filter == MOUSE_FILTER_IGNORE && data.tooltip != "") { + if (warning != String()) { + warning += "\n"; + } + warning += TTR("The Hint Tooltip won't be displayed as the control's Mouse Filter is set to \"Ignore\". To solve this, set the Mouse Filter to \"Stop\" or \"Pass\"."); + } + + return warning; +} + void Control::set_clip_contents(bool p_clip) { data.clip_contents = p_clip; diff --git a/scene/gui/control.h b/scene/gui/control.h index 2489a5eda4..1a59a6d2e4 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -487,6 +487,7 @@ public: bool is_visibility_clip_disabled() const; virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const; + virtual String get_configuration_warning() const; Control(); ~Control(); |