diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 13:14:28 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-10-31 13:14:28 +0100 |
commit | 9cfcc9131fc03693893e0ed2ac19878c392a0125 (patch) | |
tree | a132f7ef47041712ecb3f264fd314ad625b4aa68 | |
parent | 1e0edc48b5c24737a56ca81239e25ae9c0ce9327 (diff) | |
parent | 610864d1db2ac2d6ea7588994ce426c122556c54 (diff) |
Merge pull request #68079 from Mickeon/doc-help-hint
Add tooltip to method qualifiers in Documentation Help
-rw-r--r-- | editor/editor_help.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index fc5b0345d0..6df73dc8ba 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(); } |