summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicky <micheledevita2@gmail.com>2022-10-31 11:27:10 +0100
committerMicky <micheledevita2@gmail.com>2022-10-31 12:17:33 +0100
commit610864d1db2ac2d6ea7588994ce426c122556c54 (patch)
tree7da45dd90776a1bb0dcc23a439b51517e418af09
parentad3f2a234082f0d62820094199c05855115c1341 (diff)
Add tooltip to method qualifiers in Documentation Help
-rw-r--r--editor/editor_help.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 5192680787..50b4f28b70 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -368,8 +368,29 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview
class_desc->pop();
if (!p_method.qualifiers.is_empty()) {
class_desc->push_color(qualifier_color);
- class_desc->add_text(" ");
- _add_text(p_method.qualifiers);
+
+ PackedStringArray qualifiers = p_method.qualifiers.split_spaces();
+ for (const String &qualifier : qualifiers) {
+ String hint;
+ if (qualifier == "vararg") {
+ hint = TTR("This method supports a variable number of arguments.");
+ } else if (qualifier == "virtual") {
+ hint = TTR("This method is called by the engine.\nIt can be overriden to customise built-in behavior.");
+ } else if (qualifier == "const") {
+ hint = TTR("This method has no side effects.\nIt does not modify the object in any way.");
+ } else if (qualifier == "static") {
+ hint = TTR("This method does not need an instance to be called.\nIt can be called directly using the class name.");
+ }
+
+ class_desc->add_text(" ");
+ if (!hint.is_empty()) {
+ class_desc->push_hint(hint);
+ class_desc->add_text(qualifier);
+ class_desc->pop();
+ } else {
+ class_desc->add_text(qualifier);
+ }
+ }
class_desc->pop();
}