Skip to content

Feat : truncate overflowing content of TextEntry and TextUpdate, append ellipsis - #3928

Open
gabriel-desmarchelier wants to merge 3 commits into
ControlSystemStudio:masterfrom
gabriel-desmarchelier:feat-text-field-ellipsis
Open

gabriel-desmarchelier wants to merge 3 commits into
ControlSystemStudio:masterfrom
gabriel-desmarchelier:feat-text-field-ellipsis

Conversation

@gabriel-desmarchelier

Copy link
Copy Markdown

If the content of a TextEntry or a TextUpdate is wider than the width of the field, the displayed value is truncated without any warning. Our operators are quite frequently misled by this lack of accuracy.

What it currently looks like with various display formats :

image

In this PR, I created a truncateText method that truncates the actual value and appends (or prepends, depending on horizontal alignment) an ellipsis. The result is stored in the truncated_value_text string.

I use the focusProperty listener to switch the displayed text between the full and the truncated ones : whenever the widget gets the focus, one must be able to read and edit the actual value.

The behavior of the multi-line TextEntry and of the interactive TextUpdate remains unchanged : scrollbars are to be used.

The result :

image

A bob file to play with the various configurations :
text_field_truncation.tar.gz

This could also be implemented for Spinner widget.

Checklist

  • Testing:

    • The feature has automated tests
    • Tests were run
    • If not, explain how you tested your changes
  • Documentation:

    • The feature is documented
    • The documentation is up to date
    • Release notes:
      • Added an entry if the change is breaking or significant
      • Added an entry when adding a new feature

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
68.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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.

1 participant