-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show String properties' text in a tooltip in the inspector #76231
base: master
Are you sure you want to change the base?
Conversation
How does this work with properties that have doc comments? |
The value's tooltip is shown when hovering the value. The documentation is only shown when hovering the name, like before. (This also applies to properties of types other than String.) |
I don't think that's a necessary complication, all types always show their value as tooltips. |
This comment was marked as off-topic.
This comment was marked as off-topic.
42bdfbe
to
45499e3
Compare
Rebased and tested again, it works as expected. |
Moving this to 4.4 as it should've been a long time coming. |
45499e3
to
18239ee
Compare
I've trimmed the tooltip to the first 100 characters, so it should no longer get very long now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality-wise looks ok.
This allows previewing single-line or multipline strings that are too long too fit within the box in the inspector.
18239ee
to
626ee20
Compare
@@ -103,6 +107,7 @@ void EditorPropertyText::update_property() { | |||
if (text->get_text() != s) { | |||
int caret = text->get_caret_column(); | |||
text->set_text(s); | |||
text->set_tooltip_text(s.left(TOOLTIP_MAX_LENGTH).strip_edges() + String((s.length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text->set_tooltip_text(s.left(TOOLTIP_MAX_LENGTH).strip_edges() + String((s.length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); | |
text->set_tooltip_text(get_tooltip_string(s)); |
Unless something is special about this case
emit_changed(get_edited_property(), big_text->get_text(), "", true); | ||
} | ||
|
||
void EditorPropertyMultilineText::_text_changed() { | ||
text->set_tooltip_text(text->get_text().left(TOOLTIP_MAX_LENGTH).strip_edges() + String((text->get_text().length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text->set_tooltip_text(text->get_text().left(TOOLTIP_MAX_LENGTH).strip_edges() + String((text->get_text().length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); | |
text->set_tooltip_text(get_tooltip_string(text->get_text())); |
Ditto
@@ -181,6 +190,7 @@ void EditorPropertyMultilineText::update_property() { | |||
String t = get_edited_property_value(); | |||
if (text->get_text() != t) { | |||
text->set_text(t); | |||
text->set_tooltip_text(t.left(TOOLTIP_MAX_LENGTH).strip_edges() + String((t.length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
text->set_tooltip_text(t.left(TOOLTIP_MAX_LENGTH).strip_edges() + String((t.length() > TOOLTIP_MAX_LENGTH) ? "..." : "")); | |
text->set_tooltip_text(get_tooltip_string(t)); |
Ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be unnecessary now assuming the above are replaced
This allows previewing single-line or multipline strings that are too long too fit within the box in the inspector.
I wonder if it's possible to only show the tooltip if the text doesn't fully fit within the box. @bruvzg Is there a way we can detect this while taking the font size and advance into account (for both LineEdit and TextEdit)?Testing project: test_inspector_text_tooltip.zip
Preview