Add type variations for editor help in tooltips
This commit is contained in:
parent
4089843d13
commit
d378cbca65
4 changed files with 40 additions and 5 deletions
|
|
@ -4588,11 +4588,11 @@ void EditorHelpBit::update_content_height() {
|
|||
content->set_custom_minimum_size(Size2(content->get_custom_minimum_size().x, CLAMP(content_height, content_min_height, content_max_height)));
|
||||
}
|
||||
|
||||
EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_allow_selection) {
|
||||
EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, bool p_use_class_prefix, bool p_allow_selection, bool p_in_tooltip) {
|
||||
add_theme_constant_override("separation", 0);
|
||||
|
||||
title = memnew(RichTextLabel);
|
||||
title->set_theme_type_variation("EditorHelpBitTitle");
|
||||
title->set_theme_type_variation(p_in_tooltip ? "EditorHelpBitTooltipTitle" : "EditorHelpBitTitle");
|
||||
title->set_custom_minimum_size(Size2(640 * EDSCALE, 0)); // GH-93031. Set the minimum width even if `fit_content` is true.
|
||||
title->set_fit_content(true);
|
||||
title->set_selection_enabled(p_allow_selection);
|
||||
|
|
@ -4606,7 +4606,7 @@ EditorHelpBit::EditorHelpBit(const String &p_symbol, const String &p_prologue, b
|
|||
content_max_height = 360 * EDSCALE;
|
||||
|
||||
content = memnew(RichTextLabel);
|
||||
content->set_theme_type_variation("EditorHelpBitContent");
|
||||
content->set_theme_type_variation(p_in_tooltip ? "EditorHelpBitTooltipContent" : "EditorHelpBitContent");
|
||||
content->set_custom_minimum_size(Size2(640 * EDSCALE, content_min_height));
|
||||
content->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
content->set_selection_enabled(p_allow_selection);
|
||||
|
|
@ -4707,7 +4707,7 @@ Control *EditorHelpBitTooltip::make_tooltip(Control *p_target, const String &p_s
|
|||
return _make_invisible_control();
|
||||
}
|
||||
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false));
|
||||
EditorHelpBit *help_bit = memnew(EditorHelpBit(p_symbol, p_prologue, p_use_class_prefix, false, true));
|
||||
|
||||
EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target));
|
||||
help_bit->connect("request_hide", callable_mp(static_cast<Node *>(tooltip), &Node::queue_free));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue