ビューでポリゴンを描く
2016/12/13
class MyScene(QtGui.QGraphicsScene):
def __init__(self,parent):
super(MyScene, self).__init__(parent)
def drawPolygon(self,x,y):
pen = QtGui.QPen()
qc = QtGui.QColor()
qc.setNamedColor('#000000')
pen.setColor(qc)
brush = QtGui.QBrush()
brush.setStyle(QtCore.Qt.SolidPattern)
qc = QtGui.QColor()
qc.setNamedColor('#bac6ed')
brush.setColor(qc)
points = [QtCore.QPointF(x[0],y[0]),
QtCore.QPointF(x[1],y[1]),
QtCore.QPointF(x[2],y[2]),
QtCore.QPointF(x[3],y[3])]
self.addPolygon(points,pen,brush)
PySide.QtGui.QGraphicsScene.addPolygon
https://srinikom.github.io/pyside-docs/PySide/QtGui/QGraphicsScene.html#PySide.QtGui.PySide.QtGui.QGraphicsScene.addPolygon