mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
c52574c4d9
commit
23db78d486
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user