ImageItem render error if graph is too small.

Fixed issue where render would error because 'mapToDevice' would return None if the view size was too small.
This commit is contained in:
HashSplat 2017-08-31 08:55:58 -04:00
parent dd672c41b6
commit 1ea4f5ab6f

View File

@ -358,6 +358,11 @@ class ImageItem(GraphicsObject):
o = self.mapToDevice(QtCore.QPointF(0,0)) o = self.mapToDevice(QtCore.QPointF(0,0))
x = self.mapToDevice(QtCore.QPointF(1,0)) x = self.mapToDevice(QtCore.QPointF(1,0))
y = self.mapToDevice(QtCore.QPointF(0,1)) y = self.mapToDevice(QtCore.QPointF(0,1))
# Check if graphics view is too small to render anything
if o is None or x is None or y is None:
return
w = Point(x-o).length() w = Point(x-o).length()
h = Point(y-o).length() h = Point(y-o).length()
if w == 0 or h == 0: if w == 0 or h == 0: