From 19632c98e66dd8fbdd5f91adaea12c451453aa20 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Jun 2025 09:30:38 +0530 Subject: [PATCH] Improve rendering of icon theme descriptions when description is too long to fit --- src/calibre/gui2/icon_theme.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/icon_theme.py b/src/calibre/gui2/icon_theme.py index 70958f2f76..19ab50408a 100644 --- a/src/calibre/gui2/icon_theme.py +++ b/src/calibre/gui2/icon_theme.py @@ -619,8 +619,8 @@ class Delegate(QStyledItemDelegate): text = _('''\

{title}

by {author} with {number} icons [{size}]

-

{description}

Version: {version} Number of users: {usage:n}

+

{description}

{visit}

''').format(title=escape(theme.get('title') or _('Unknown')), author=escape(theme.get('author', _('Unknown'))), number=theme.get('number', 0), description=escape(theme.get('description', '')), @@ -630,6 +630,8 @@ class Delegate(QStyledItemDelegate): st = self.static_text_cache.get(text) if st is None: self.static_text_cache[text] = st = QStaticText(text) + st.setTextWidth(option.rect.width() - COVER_SIZE[0] - self.SPACING - 2) + painter.setClipRect(option.rect.adjusted(0, 0, 0, -2)) painter.drawStaticText(COVER_SIZE[0] + self.SPACING, option.rect.top() + self.SPACING, st) painter.restore()