Merge pull request #38934 from KoBeWi/where_to_setget

Link exposed setters/getters in property descriptions
This commit is contained in:
Rémi Verschelde 2020-06-16 09:25:27 +02:00 committed by GitHub
commit 3fa863dbb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1033,6 +1033,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
@ -1040,7 +1045,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");
@ -1057,7 +1069,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");