Skip to content

Commit

Permalink
Scale count right margin by devicepixelratio
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Oct 27, 2024
1 parent b51c799 commit 57017c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/calibre/gui2/tag_browser/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from collections import defaultdict
from contextlib import suppress
from functools import partial
from math import ceil

from qt.core import (
QAbstractItemView,
Expand Down Expand Up @@ -113,7 +114,8 @@ def render_count():
count = str(index.data(COUNT_ROLE))
width = painter.fontMetrics().boundingRect(count).width()
r = QRect(tr)
r.setRight(r.right() - 1), r.setLeft(r.right() - width - 4)
dr = 1 if widget is None else widget.devicePixelRatioF()
r.setRight(r.right() - 1), r.setLeft(r.right() - width - int(ceil(4 * dr)))
painter.drawText(r, Qt.AlignmentFlag.AlignCenter | Qt.TextFlag.TextSingleLine, count)
tr.setRight(r.left() - 1)
else:
Expand Down

0 comments on commit 57017c4

Please sign in to comment.