Cover grid: Vertically center covers that are smaller than the available space. Fixes #1886731 [Enhancement request: Vertically centering images in book grid](https://bugs.launchpad.net/calibre/+bug/1886731)

This commit is contained in:
Kovid Goyal 2020-07-08 19:26:01 +05:30
parent c52574c4d9
commit 23db78d486
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -565,9 +565,9 @@ class CoverDelegate(QStyledItemDelegate):
dpr = cdata.devicePixelRatio()
cw, ch = int(cdata.width() / dpr), int(cdata.height() / dpr)
dx = max(0, int((rect.width() - cw)/2.0))
dy = max(0, rect.height() - ch)
dy = max(0, int((rect.height() - ch)/2.0))
right_adjust = dx
rect.adjust(dx, dy, -dx, 0)
rect.adjust(dx, dy, -dx, -dy)
painter.drawPixmap(rect, cdata)
if self.title_height != 0:
self.paint_title(painter, trect, db, book_id)