junix
13th April 2012, 22:11
Hi people, :)
I'd like to set the scene itens atleast 10 points from the top and left GraphicsView border.
But I couldn't until now.
7584
A piece of my PyQt code:
(...)
picture = "ui/snap/" + gamepicture
if not os.path.isfile(picture):
picture = "ui/pixmaps/nopic.png"
if gamestatus:
color = QtGui.QColor(0, 0, 0, 0)
pix = QtGui.QPixmap(QtCore.QSize(238, 174))
pix.fill(color)
rect = QtCore.QRectF(0.0, 0.0, 238, 174)
painter = QtGui.QPainter()
painter.begin(pix)
painter.setRenderHints(QtGui.QPainter.Antialiasing , True)
path = QtGui.QPainterPath()
path.addRoundedRect(rect, 10.0, 10.0)
painter.drawPath(path)
brush = QtGui.QBrush()
brush.setTexture(QtGui.QPixmap(picture))
painter.fillPath(path, brush)
painter.end()
pixItem = GameItem(gameid, pix, None, self.scene)
pixItem.setPos((260 * col), lin)
col += 1
if col >= 6:
lin += 220
col = 0
self.graphicsView.setScene(self.scene)
self.graphicsView.setAlignment(QtCore.Qt.AlignLeft )
(...)
Some tip?
BR,
Junix
I'd like to set the scene itens atleast 10 points from the top and left GraphicsView border.
But I couldn't until now.
7584
A piece of my PyQt code:
(...)
picture = "ui/snap/" + gamepicture
if not os.path.isfile(picture):
picture = "ui/pixmaps/nopic.png"
if gamestatus:
color = QtGui.QColor(0, 0, 0, 0)
pix = QtGui.QPixmap(QtCore.QSize(238, 174))
pix.fill(color)
rect = QtCore.QRectF(0.0, 0.0, 238, 174)
painter = QtGui.QPainter()
painter.begin(pix)
painter.setRenderHints(QtGui.QPainter.Antialiasing , True)
path = QtGui.QPainterPath()
path.addRoundedRect(rect, 10.0, 10.0)
painter.drawPath(path)
brush = QtGui.QBrush()
brush.setTexture(QtGui.QPixmap(picture))
painter.fillPath(path, brush)
painter.end()
pixItem = GameItem(gameid, pix, None, self.scene)
pixItem.setPos((260 * col), lin)
col += 1
if col >= 6:
lin += 220
col = 0
self.graphicsView.setScene(self.scene)
self.graphicsView.setAlignment(QtCore.Qt.AlignLeft )
(...)
Some tip?
BR,
Junix