Skip to content

Show truncated text in tooltips (#31908, #27891, #32159) [4.7.0]#32345

Draft
mathesoncalum wants to merge 6 commits intomusescore:4.7from
mathesoncalum:truncate_text_labels
Draft

Show truncated text in tooltips (#31908, #27891, #32159) [4.7.0]#32345
mathesoncalum wants to merge 6 commits intomusescore:4.7from
mathesoncalum:truncate_text_labels

Conversation

@mathesoncalum
Copy link
Contributor

Resolves: #31908
Resolves: #27891
Resolves: #32159

Screenshot 2026-02-23 at 10 24 14 Screenshot 2026-02-23 at 10 24 01

I was hoping to come up with a clean, general solution that works in all cases for this one but there are a few cases that require special treatment - usually when the MouseArea for a StyledTextLabel overlaps with another MouseArea underneath. FlatButtons are an example of this - allowing the StyledTextLabel to accept hover events here would result in it intercepting hover events for the button underneath (where we have the HOVERED state). So in this case you would need to integrate the "truncation" logic with the existing MouseArea logic for the button. The buttons in the sound flag popup actually add another layer of complexity since they supply their own StyledTextLabels through contentItem. As a result, there isn't really a satisfying way to have the FlatButton evaluate whether the text is truncated and perform the necessary tooltip logic.

The solution for the sound flag popup proposed in this PR is quite simple - once the contentItem is completed we'll set the button's tooltip title (if truncated). For most other cases we can use the new displayTruncatedTextOnHover property. As mentioned previously, we should be careful not to steal hover events with StyledTextLabels. For this reason, the default value for this property is false - we can set it to true on a case-by-case basis.

Important: 0657c25 is purely for testing purposes. It should be dropped from this PR before merging.

font: ui.theme.bodyBoldFont
horizontalAlignment: Text.AlignLeft
wrapMode: Text.WordWrap
maximumLineCount: 2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively we could accommodate blank titles and use the description text instead...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Soundflag options need to show full text Add tooltip for truncated property field labels Instrument descriptions get cut off in New Score dialog

3 participants