summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Chabora <kobewi4e@gmail.com>2020-05-21 21:07:44 +0200
committerTomasz Chabora <kobewi4e@gmail.com>2020-06-15 20:54:10 +0200
commitea07acb877b9c888c281f7af65b0a22f147e8426 (patch)
tree93af873cc3cf186c43edfa6584e2a87a4f6eece3
parent9239412027b6c25009efab69dc39650e0d76c56d (diff)
Link exposed set/getters in property descriptions
-rw-r--r--editor/editor_help.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 30cf7d1e7a..d4ff9b7ee9 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1015,6 +1015,11 @@ void EditorHelp::_update_doc() {
class_desc->pop(); // font
class_desc->pop(); // cell
+ Map<String, DocData::MethodDoc> method_map;
+ for (int j = 0; j < methods.size(); j++) {
+ method_map[methods[j].name] = methods[j];
+ }
+
if (cd.properties[i].setter != "") {
class_desc->push_cell();
class_desc->pop(); // cell
@@ -1022,7 +1027,14 @@ void EditorHelp::_update_doc() {
class_desc->push_cell();
class_desc->push_font(doc_code_font);
class_desc->push_color(text_color);
- class_desc->add_text(cd.properties[i].setter + TTR("(value)"));
+ if (method_map[cd.properties[i].setter].arguments.size() > 1) {
+ // Setters with additional arguments are exposed in the method list, so we link them here for quick access.
+ class_desc->push_meta("@method " + cd.properties[i].setter);
+ class_desc->add_text(cd.properties[i].setter + TTR("(value)"));
+ class_desc->pop();
+ } else {
+ class_desc->add_text(cd.properties[i].setter + TTR("(value)"));
+ }
class_desc->pop(); // color
class_desc->push_color(comment_color);
class_desc->add_text(" setter");
@@ -1039,7 +1051,14 @@ void EditorHelp::_update_doc() {
class_desc->push_cell();
class_desc->push_font(doc_code_font);
class_desc->push_color(text_color);
- class_desc->add_text(cd.properties[i].getter + "()");
+ if (method_map[cd.properties[i].getter].arguments.size() > 0) {
+ // Getters with additional arguments are exposed in the method list, so we link them here for quick access.
+ class_desc->push_meta("@method " + cd.properties[i].getter);
+ class_desc->add_text(cd.properties[i].getter + "()");
+ class_desc->pop();
+ } else {
+ class_desc->add_text(cd.properties[i].getter + "()");
+ }
class_desc->pop(); //color
class_desc->push_color(comment_color);
class_desc->add_text(" getter");