--- a/Graphics/UMLGraphicsView.py Tue Sep 04 11:41:07 2012 +0200 +++ b/Graphics/UMLGraphicsView.py Sat Sep 08 18:28:46 2012 +0200 @@ -8,7 +8,7 @@ """ from PyQt4.QtCore import pyqtSignal, Qt, QSignalMapper, QFileInfo, QEvent -from PyQt4.QtGui import QAction, QToolBar, QDialog, QPrinter, QPrintDialog +from PyQt4.QtGui import QAction, QToolBar, QDialog, QPrinter, QPrintDialog, QGraphicsView from E5Graphics.E5GraphicsView import E5GraphicsView @@ -45,6 +45,7 @@ E5GraphicsView.__init__(self, scene, parent) if name: self.setObjectName(name) + self.setViewportUpdateMode(QGraphicsView.FullViewportUpdate) self.diagramName = diagramName @@ -180,11 +181,11 @@ """ diagramSize = self._getDiagramSize(10) sceneRect = self.scene().sceneRect() - if (sceneRect.width() - self.deltaSize) <= diagramSize.width(): + if (sceneRect.width() - self.deltaSize) < diagramSize.width(): self.decWidthAct.setEnabled(False) else: self.decWidthAct.setEnabled(True) - if (sceneRect.height() - self.deltaSize) <= diagramSize.height(): + if (sceneRect.height() - self.deltaSize) < diagramSize.height(): self.decHeightAct.setEnabled(False) else: self.decHeightAct.setEnabled(True) @@ -200,6 +201,19 @@ else: self.deleteShapeAct.setEnabled(False) + sceneRect = self.scene().sceneRect() + newWidth = width = sceneRect.width() + newHeight = height = sceneRect.height() + rect = self._getDiagramRect(10) + if width < rect.width(): + newWidth = rect.width() + if height < rect.height(): + newHeight = rect.height() + + if newHeight != height or newWidth != width: + self.setSceneSize(newWidth, newHeight) + self.__checkSizeActions() + def initToolBar(self): """ Public method to populate a toolbar with our actions. @@ -359,10 +373,7 @@ """ Private method to handle the re-layout context menu entry. """ - scene = self.scene() - for itm in list(scene.items())[:]: - if itm.scene() == scene: - scene.removeItem(itm) + self.scene().clear() self.relayout.emit() def __printDiagram(self):