Fix #27891: Show full instrument description in tooltip when truncated, for consistent accessibility #31409
+18
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #27891
Summary
This PR allows for the full descriptions of instruments to remain accessible to users even in the event that their original descriptions became truncated. In order to avoid crowding the description text, it also enforces a
maximumLineCountof2, as decided in the linked report.Specifics
As discussed, the targeted solution for this behavior was to expose a tooltip on hover of the description text. However, this tooltip should only show up if the text is truncated after taking up both lines. As far as I know, QML does not provide a native flag for detecting multi-line text truncation. Therefore this PR implements the
isTruncatedproperty:isTruncated: Number of text lines is equal to the maximumLineCount (2) AND the contentWidth exceeds the widthThis allowed for pretty good truncation state tracking (note I specified a buffer of
11here to handle some inconsistencies, where this was the largest difference I observed when manually testing).Then, using this property, the description text can be hovered over and if truncated a tooltip (as shown in the attachments) will appear below as requested.
Testing