diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-06-01 18:34:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-01 18:34:39 +0200 |
commit | c762ec134321f0710b2c8cfe3939abe76f12ff68 (patch) | |
tree | ed6ac5ebc0e821226e70683d5c48d461f959e266 | |
parent | cd7871867faae0d1aa4c2bf5cd6dae8ea8f4237c (diff) | |
parent | a65404e6ac088e9f4584e99320d0cff467f597e9 (diff) |
Merge pull request #60984 from fire-forge/doc-icon
Show class icon in the documentation page header
-rw-r--r-- | editor/editor_help.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 19ffb6f0f5..b4325f09c5 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -523,11 +523,22 @@ void EditorHelp::_update_doc() { DocData::ClassDoc cd = doc->class_list[edited_class]; // Make a copy, so we can sort without worrying. + Ref<Texture2D> icon; + if (has_theme_icon(edited_class, SNAME("EditorIcons"))) { + icon = get_theme_icon(edited_class, SNAME("EditorIcons")); + } else if (ClassDB::class_exists(edited_class) && ClassDB::is_parent_class(edited_class, "Object")) { + icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); + } else { + icon = get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons")); + } + // Class name section_line.push_back(Pair<String, int>(TTR("Top"), 0)); class_desc->push_font(doc_title_font); class_desc->push_color(title_color); class_desc->add_text(TTR("Class:") + " "); + class_desc->add_image(icon, icon->get_width(), icon->get_height()); + class_desc->add_text(" "); class_desc->push_color(headline_color); _add_text(edited_class); class_desc->pop(); |