Merge pull request #1439 from ynput/enhancement/elide-status-name-text

Loader: Elide status name text
This commit is contained in:
Jakub Trllo 2025-09-15 14:25:31 +02:00 committed by GitHub
commit 1528cc6364
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -186,8 +186,15 @@ class StatusDelegate(QtWidgets.QStyledItemDelegate):
)
fm = QtGui.QFontMetrics(option.font)
if text_rect.width() < fm.width(text):
text = self._get_status_short_name(index)
if text_rect.width() < fm.width(text):
short_text = self._get_status_short_name(index)
if short_text:
text = short_text
text = fm.elidedText(
text, QtCore.Qt.ElideRight, text_rect.width()
)
# Allow at least one character
if len(text) < 2:
text = ""
fg_color = self._get_status_color(index)