[Tree] Allow disabling auto generated tooltip for `TreeItem`
The specifics of if the original behavior is desirable can be discussed, but this should be the most non-obtrusive approach to this, not disrupting existing behavior and just allowing you to configure this as wished
- Closes: https://github.com/godotengine/godot/issues/97154
Thank You.
Future improvement could involve checking the fit of the text, like is done in TabBar:
https://github.com/godotengine/godot/blob/694d3c2930bdfb43fd93e1e6641f66c4f19a5c77/scene/gui/tab_bar.cpp#L326-L337
But that'd involve some more complex changes here so will leave that to a future improvement
But that'd involve some more complex changes here so will leave that to a future improvement
Since we already can set a custom tooltip, it may look like this.
String ItemList::get_tooltip() {
if (auto_tooltip || not_fit) {
String item_tooltip = text;
if (!tooltip.is_empty()) {
item_tooltip += "\n" + tooltip;
}
return item_tooltip;
}
return tooltip;
}
I'll test some truncation code today and if it works out well I'll integrate it into this PR directly, but will keep it simple and match TabBar in that it won't combine the text and the tooltip and if you set a custom tooltip you'll have to do that yourself if you want it, the tooltip when set should be exactly what you set it as
Haven't gotten around to digging into using truncation here so taking this out of draft on its own and will look at adding truncation checks when I can
Looks like ItemList has something similar, but the tooltip is disabled per-item and regardless of tooltip text. Configuring auto behavior for the whole node makes more sense.
Thanks!
Thank you!