summaryrefslogtreecommitdiffstats
path: root/editor/property_selector.cpp
diff options
context:
space:
mode:
authorDanil Alexeev <danil@alexeev.xyz>2024-04-11 11:21:44 +0300
committerDanil Alexeev <danil@alexeev.xyz>2024-04-18 14:32:04 +0300
commita714cb9f65faefaa21bef240397ca6d249edd53c (patch)
tree9ce34904d2641410dafd914d9f816df99e21b5b5 /editor/property_selector.cpp
parent3b1806182a3564736ad64793b203c2c13c251f56 (diff)
downloadredot-engine-a714cb9f65faefaa21bef240397ca6d249edd53c.tar.gz
Editor: Display deprecated/experimental messages in tooltips
Diffstat (limited to 'editor/property_selector.cpp')
-rw-r--r--editor/property_selector.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/editor/property_selector.cpp b/editor/property_selector.cpp
index ac175d01a6..d7af751f95 100644
--- a/editor/property_selector.cpp
+++ b/editor/property_selector.cpp
@@ -87,7 +87,7 @@ void PropertySelector::_update_search() {
}
search_options->clear();
- help_bit->set_text("");
+ help_bit->set_custom_text(String(), String(), String());
TreeItem *root = search_options->create_item();
@@ -353,7 +353,7 @@ void PropertySelector::_confirmed() {
}
void PropertySelector::_item_selected() {
- help_bit->set_text("");
+ help_bit->set_custom_text(String(), String(), String());
TreeItem *item = search_options->get_selected();
if (!item) {
@@ -372,25 +372,21 @@ void PropertySelector::_item_selected() {
String text;
while (!class_type.is_empty()) {
- text = properties ? help_bit->get_property_description(class_type, name) : help_bit->get_method_description(class_type, name);
- if (!text.is_empty()) {
- break;
+ if (properties) {
+ if (ClassDB::has_property(class_type, name, true)) {
+ help_bit->parse_symbol("property|" + class_type + "|" + name);
+ break;
+ }
+ } else {
+ if (ClassDB::has_method(class_type, name, true)) {
+ help_bit->parse_symbol("method|" + class_type + "|" + name);
+ break;
+ }
}
// It may be from a parent class, keep looking.
class_type = ClassDB::get_parent_class(class_type);
}
-
- if (!text.is_empty()) {
- // Display both property name and description, since the help bit may be displayed
- // far away from the location (especially if the dialog was resized to be taller).
- help_bit->set_text(vformat("[b]%s[/b]: %s", name, text));
- help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 1));
- } else {
- // Use nested `vformat()` as translators shouldn't interfere with BBCode tags.
- help_bit->set_text(vformat(TTR("No description available for %s."), vformat("[b]%s[/b]", name)));
- help_bit->get_rich_text()->set_self_modulate(Color(1, 1, 1, 0.5));
- }
}
void PropertySelector::_hide_requested() {
@@ -569,8 +565,7 @@ PropertySelector::PropertySelector() {
search_options->set_hide_folding(true);
help_bit = memnew(EditorHelpBit);
- vbc->add_margin_child(TTR("Description:"), help_bit);
- help_bit->get_rich_text()->set_fit_content(false);
- help_bit->get_rich_text()->set_custom_minimum_size(Size2(help_bit->get_rich_text()->get_minimum_size().x, 135 * EDSCALE));
+ help_bit->set_content_height_limits(80 * EDSCALE, 80 * EDSCALE);
help_bit->connect("request_hide", callable_mp(this, &PropertySelector::_hide_requested));
+ vbc->add_margin_child(TTR("Description:"), help_bit);
}