def paint(self, painter, option, widget):
painter.setPen(QtCore.Qt.NoPen)
if self.graphWidget.VisualizationTheme == "ObjectFlow":
self.drawSubClusters(painter, self.radius)
painter.setBrush(self.CommunityColor)
painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))
if (option.state & QtGui.QStyle.State_Selected):
circle_path = QtGui.QPainterPath()
painter.setPen(QtGui.QPen(QtCore.Qt.blue, 3))
circle_path.addEllipse(QtCore.QPointF(0,0),self.radius+2,self.radius+2);
painter.drawPath(circle_path)
else:
painter.drawEllipse(-4, -4, self.radius, self.radius)
elif self.graphWidget.VisualizationTheme == "ThemeRiver":
self.drawSubClustersTheme(painter,option, self.radius)
# Drawing the CirclePath Should denote a value
python类QPainterPath()的实例源码
def paint(self, painter, option, widget):
painter.setPen(QtCore.Qt.NoPen)
if self.graphWidget.VisualizationTheme == "ObjectFlow":
self.drawSubClusters(painter, self.radius)
painter.setBrush(self.CommunityColor)
painter.setPen(QtGui.QPen(QtCore.Qt.black, 0))
if (option.state & QtGui.QStyle.State_Selected):
circle_path = QtGui.QPainterPath()
painter.setPen(QtGui.QPen(QtCore.Qt.blue, 3))
circle_path.addEllipse(QtCore.QPointF(0,0),self.radius+2,self.radius+2);
painter.drawPath(circle_path)
else:
painter.drawEllipse(-4, -4, self.radius, self.radius)
elif self.graphWidget.VisualizationTheme == "ThemeRiver":
self.drawSubClustersTheme(painter,option, self.radius)
# Drawing the CirclePath Should denote a value
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-10, -10, 20, 20)
return path
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-10, -10, 20, 20)
return path
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-40, -40, 70, 70)
return path
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-40, -40, 70, 70)
return path
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-40, -40, 70, 70)
return path
def shape(self):
path = QtGui.QPainterPath()
path.addEllipse(-10, -10, 20, 20)
return path
def _draw_graph(self):
if self._graph is None:
self._new_graph()
elif self._graph.size() != self.size():
self._new_graph()
painter = QtGui.QPainter(self._graph)
try:
painter.setRenderHint(QtGui.QPainter.Antialiasing)
painter.fillRect(0, 0, self._graph.width(), self._graph.height(), QtGui.QColor(0, 0, 0, 10))
if self._frame:
frequency_axis, rssi_values = self._frame
path_now = QtGui.QPainterPath()
path_max = QtGui.QPainterPath()
bins = range(len(frequency_axis))
x_axis = self._hz_to_x(frequency_axis)
y_now = self._dbm_to_y(rssi_values)
y_max = self._dbm_to_y(numpy.amax(self._persisted_frames, axis=0))
# TODO: Wrapped Numpy types with float() to support old (<1.0) PySide API in Ubuntu 10.10
path_now.moveTo(float(x_axis[0]), float(y_now[0]))
for i in bins:
path_now.lineTo(float(x_axis[i]), float(y_now[i]))
# TODO: Wrapped Numpy types with float() to support old (<1.0) PySide API in Ubuntu 10.10
path_max.moveTo(float(x_axis[0]), float(y_max[0]))
for i in bins:
path_max.lineTo(float(x_axis[i]), float(y_max[i]))
painter.setPen(Qt.white)
painter.drawPath(path_now)
self._path_max = path_max
finally:
painter.end()