Fix placement of overly large ImageBlocks

This commit is contained in:
Kovid Goyal 2007-09-23 00:27:26 +00:00
parent 2adf7f1d13
commit 5a21453397

View File

@ -644,6 +644,13 @@ class _Canvas(QGraphicsRectItem):
self.is_full = True
else:
br = ib.boundingRect()
max_height = min(br.height(), self.max_y-y)
max_width = min(br.width(), self.max_x-x)
if br.height() > max_height or br.width() > max_width:
p = ib.pixmap()
ib.setPixmap(p.scaled(max_width, max_height, Qt.IgnoreAspectRatio,
Qt.SmoothTransformation))
br = ib.boundingRect()
ib.setParentItem(self)
ib.setPos(x, y)
self.current_y = y + br.height()