Editor: Fix Tag Overrun Behavior#119088
Conversation
dcc2802 to
ef61fee
Compare
|
Why is this in NOTIFICATION_READY, not the constructor? |
|
|
|
That's very hacky, but if it works... 🤔 |
|
Yeah, I spent the better part of a day trying to figure this out. At first I used |
There was a problem hiding this comment.
Ideally, buttons would properly support the flag, but that would require changes out of scope for 4.7 (and yes, I will get it done for 4.8).
The solution you put forward is rather hacky, as KoBeWi pointed out, but it's contained to the editor tags, so I support it as a temporary solution. If it works, it works.
|
Yeah, I don't mind cleaning this up when buttons use internal labels as it'll no longer be a necessary bandaid. |
|
You could add a FIXME or HACK comment pointing at the better solution. |
e3d0283 to
be8d7f4
Compare
Repiteo
left a comment
There was a problem hiding this comment.
No need for a HACK and FIXME comment; just the one will suffice
| //HACK: can't be set in constructor because get_size() returns empty, will be made unnecessary when Button utilizes internal labels. | ||
| if (p_what == NOTIFICATION_READY) { | ||
| button->set_custom_minimum_size(get_size()); | ||
| button->set_text_overrun_behavior(TextServer::OverrunBehavior::OVERRUN_TRIM_ELLIPSIS); //FIXME: Move to constructor when Button utilizes internal labels. |
There was a problem hiding this comment.
Adjusted to fit our comment style guidelines:
| //HACK: can't be set in constructor because get_size() returns empty, will be made unnecessary when Button utilizes internal labels. | |
| if (p_what == NOTIFICATION_READY) { | |
| button->set_custom_minimum_size(get_size()); | |
| button->set_text_overrun_behavior(TextServer::OverrunBehavior::OVERRUN_TRIM_ELLIPSIS); //FIXME: Move to constructor when Button utilizes internal labels. | |
| // HACK: Can't set overrun behavior in constructor because `get_size()` would return empty. | |
| // This logic should be migrated once `Button` utilizes internal labels. | |
| if (p_what == NOTIFICATION_READY) { | |
| button->set_custom_minimum_size(get_size()); | |
| button->set_text_overrun_behavior(TextServer::OverrunBehavior::OVERRUN_TRIM_ELLIPSIS); |
985e26e to
6bfce50
Compare
Fixes an issue with not being able to set overrun behaviour on tags without the button size zeroing out.
6bfce50 to
86eb276
Compare
Supplemental Fix to #118876. In that PR I was unable to set the overrun behaviour as recommended by @KoBeWi in this comment. This fix gets the overrun to behave properly by utilising the
set_custom_minimum_sizeby plugging in the size it currently is, this is done when NOTIFICATION_READY is emitted.