Commit 7fce0ce5 authored by Luke Campagnola's avatar Luke Campagnola
Browse files

Allow GraphicsView.setCentralItem(None)

parent a50f74a1
......@@ -1322,6 +1322,8 @@ class ViewBox(GraphicsWidget):
k.destroyed.disconnect()
except RuntimeError: ## signal is already disconnected.
pass
except TypeError: ## view has already been deleted (?)
pass
def locate(self, item, timeout=3.0, children=False):
"""
......
......@@ -181,8 +181,9 @@ class GraphicsView(QtGui.QGraphicsView):
if self.centralWidget is not None:
self.scene().removeItem(self.centralWidget)
self.centralWidget = item
self.sceneObj.addItem(item)
self.resizeEvent(None)
if item is not None:
self.sceneObj.addItem(item)
self.resizeEvent(None)
def addItem(self, *args):
return self.scene().addItem(*args)
......@@ -272,7 +273,8 @@ class GraphicsView(QtGui.QGraphicsView):
scaleChanged = True
self.range = newRect
#print "New Range:", self.range
self.centralWidget.setGeometry(self.range)
if self.centralWidget is not None:
self.centralWidget.setGeometry(self.range)
self.updateMatrix(propagate)
if scaleChanged:
self.sigScaleChanged.emit(self)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment