diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-07-28 15:40:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-28 15:40:18 +0200 |
commit | 31c67a0fa024d688a262df91e6c97cbd873c1da2 (patch) | |
tree | 10a011a7eae146e31130d9f8d75b7e6b1476742e /editor | |
parent | 4e4702e3868af342b0e2964c7753fa4a3aa83af8 (diff) | |
parent | 578c8fc1e53f1c27a6ff976a5bcd2ceab2146e0a (diff) |
Merge pull request #20535 from akien-mga/layers-tooltips
Fix layer 2-line tooltips used as name in inspector
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_properties.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 4fae8467b4..79490f1c8e 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -568,6 +568,7 @@ public: uint32_t value; Vector<Rect2> flag_rects; Vector<String> names; + Vector<String> tooltips; virtual Size2 get_minimum_size() const { Ref<Font> font = get_font("font", "Label"); @@ -576,8 +577,8 @@ public: virtual String get_tooltip(const Point2 &p_pos) const { for (int i = 0; i < flag_rects.size(); i++) { - if (i < names.size() && flag_rects[i].has_point(p_pos)) { - return names[i]; + if (i < tooltips.size() && flag_rects[i].has_point(p_pos)) { + return tooltips[i]; } } return String(); @@ -681,6 +682,7 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) { } Vector<String> names; + Vector<String> tooltips; for (int i = 0; i < 20; i++) { String name; @@ -692,12 +694,12 @@ void EditorPropertyLayers::setup(LayerType p_layer_type) { name = TTR("Layer") + " " + itos(i + 1); } - name += "\n" + vformat(TTR("Bit %d, value %d"), i, 1 << i); - names.push_back(name); + tooltips.push_back(name + "\n" + vformat(TTR("Bit %d, value %d"), i, 1 << i)); } grid->names = names; + grid->tooltips = tooltips; } void EditorPropertyLayers::_button_pressed() { |