summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-03-20 17:51:53 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-03-26 15:49:45 +0100
commit047e0b7de5ca981d955739074919646fade828fb (patch)
tree6fe439ae04e6edc90aecc6ebb072310234c6178c /editor
parentb3080bc2f4d7bc5c15b3a0ff7b67690c4677577e (diff)
Reworked tooltips to use the popup system.
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_help.cpp8
-rw-r--r--editor/editor_help.h2
-rw-r--r--editor/editor_inspector.cpp9
-rw-r--r--editor/editor_themes.cpp2
4 files changed, 16 insertions, 5 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 23121dd093..9d8c46cc2d 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -1610,6 +1610,11 @@ void EditorHelpBit::_bind_methods() {
void EditorHelpBit::_notification(int p_what) {
switch (p_what) {
+ case NOTIFICATION_READY: {
+ rich_text->clear();
+ _add_text_to_rt(text, rich_text);
+
+ } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
rich_text->add_theme_color_override("selection_color", get_theme_color("accent_color", "Editor") * Color(1, 1, 1, 0.4));
@@ -1620,8 +1625,9 @@ void EditorHelpBit::_notification(int p_what) {
void EditorHelpBit::set_text(const String &p_text) {
+ text = p_text;
rich_text->clear();
- _add_text_to_rt(p_text, rich_text);
+ _add_text_to_rt(text, rich_text);
}
EditorHelpBit::EditorHelpBit() {
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 0d3ecf9bd0..d9c7194003 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -200,6 +200,8 @@ class EditorHelpBit : public PanelContainer {
void _go_to_help(String p_what);
void _meta_clicked(String p_select);
+ String text;
+
protected:
static void _bind_methods();
void _notification(int p_what);
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index fd0b02621c..ba02f8e99f 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -776,13 +776,14 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
tooltip_text = p_text;
EditorHelpBit *help_bit = memnew(EditorHelpBit);
- help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
+ //help_bit->add_theme_style_override("panel", get_theme_stylebox("panel", "TooltipPanel"));
help_bit->get_rich_text()->set_fixed_size_to_width(360 * EDSCALE);
+ String text;
PackedStringArray slices = p_text.split("::", false);
if (!slices.empty()) {
String property_name = slices[0].strip_edges();
- String text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
+ text = TTR("Property:") + " [u][b]" + property_name + "[/b][/u]";
if (slices.size() > 1) {
String property_doc = slices[1].strip_edges();
@@ -790,7 +791,7 @@ Control *EditorProperty::make_custom_tooltip(const String &p_text) const {
text += "\n" + property_doc;
}
}
- help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
+ help_bit->set_text(text);
}
return help_bit;
@@ -1026,7 +1027,7 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons
text += "\n" + property_doc;
}
}
- help_bit->call_deferred("set_text", text); //hack so it uses proper theme once inside scene
+ help_bit->set_text(text); //hack so it uses proper theme once inside scene
}
return help_bit;
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 4eedf61a5f..ac902854b7 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -977,6 +977,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
+ theme->set_stylebox("panel", "EditorHelpBit", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
+
theme->set_color("headline_color", "EditorHelp", mono_color);
// Panel