1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Add tooltip description wrapping in scene tree and plugin settings

(cherry picked from commit d007be2d14)
This commit is contained in:
mb4c
2023-07-06 08:45:07 +02:00
committed by Yuri Sizov
parent 8cea540eba
commit 6018ff49d6
2 changed files with 18 additions and 2 deletions

View File

@@ -101,9 +101,18 @@ void EditorPluginSettings::update_plugins() {
String description = cf->get_value("plugin", "description");
String scr = cf->get_value("plugin", "script");
const PackedInt32Array boundaries = TS->string_get_word_breaks(description, "", 80);
String wrapped_description;
for (int j = 0; j < boundaries.size(); j += 2) {
const int start = boundaries[j];
const int end = boundaries[j + 1];
wrapped_description += "\n" + description.substr(start, end - start + 1).rstrip("\n");
}
TreeItem *item = plugin_list->create_item(root);
item->set_text(0, name);
item->set_tooltip_text(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + scr + "\n" + TTR("Description:") + " " + description);
item->set_tooltip_text(0, TTR("Name:") + " " + name + "\n" + TTR("Path:") + " " + path + "\n" + TTR("Main Script:") + " " + scr + "\n" + TTR("Description:") + " " + wrapped_description);
item->set_metadata(0, path);
item->set_text(1, version);
item->set_metadata(1, scr);