#scale increase
self.connect(self.incScaleButton, QtCore.SIGNAL("clicked()"),lambda who="incScale": self.incScale())
#scale decrease
self.connect(self.decScaleButton, QtCore.SIGNAL("clicked()"),lambda who="decScale": self.decScale())
#create Scene for show diagrams
self.sc=QtGui.QGraphicsScene(self.graphicsView)
def incScale(self):
self.scale+=0.1
self.printGDP(scale=self.scale)
def decScale(self):
self.scale-=0.1
self.printGDP(scale=self.scale)
#show diagram:
filename=fileArrayt[fileNumber]
#create object for SVG modification
r=QtSvg.QSvgRenderer()
#load data
r.load(QtCore.QByteArray(arrayToSave))
#change rectangle for our image
r.setViewBox(QtCore.QRectF(0.0, 0.0, 3200.0, 2000))
#create additional element
item=QtSvg.QGraphicsSvgItem()
#put our image into it
item.setSharedRenderer(r)
#change scale
item.setScale(1.0)
#clear Scene, change size of it
self.sc.clear()
self.sc.setSceneRect(QtCore.QRectF(0.0, 0.0, 3200.0, 2000))
#change position of item into Scene
item.setPos(QtCore.QPointF(10,50))
#add item to Scene
self.sc.addItem(item)
#for QGraphicsView set Scene, define "view point"
self.graphicsView.setScene(self.sc)
self.graphicsView.centerOn(0,0)
Комментариев нет:
Отправить комментарий