def setZoom(self, zoom): """ Sets its own zoom factor and passes it to it's child widget if child is Zoomable. """ Zoomable.setZoom(self, zoom) if isinstance(self.widget(), ZoomableWidget): self.widget().setZoom(zoom) self.autosizeScrollWidget() self.emit(SIGNAL("zoomChanged(float)"), zoom)
def __init__(self, parent=None): """ Constructor. """ QScrollArea.__init__(self, parent) Zoomable.__init__(self) # Call after QScrollArea constructor, required by setZoom() self.connect(self.verticalScrollBar(), SIGNAL("valueChanged(int)"), self.scrollBarValueChanged) self.connect(self.horizontalScrollBar(), SIGNAL("valueChanged(int)"), self.scrollBarValueChanged)
def setZoom(self, zoom): """ Sets zoom of this widget and of it's children. """ Zoomable.setZoom(self, zoom) for child in self.children(): if isinstance(child, Zoomable): child.setZoom(zoom) self.update()
def __init__(self, parent=None): """ Constructor """ QWidget.__init__(self, parent) Zoomable.__init__(self) self._imageExporter = None if isinstance(self.parent(), ZoomableWidget): self.setZoom(self.parent().zoom())