def _draw_widget(self, qp):
font = QFont('Serif', 7, QFont.Light)
qp.setFont(font)
size = self.size()
w = size.width()
h = size.height()
pen = QPen(QColor(180, 180, 180), 3,
Qt.SolidLine)
qp.setPen(pen)
qp.drawLine(1, h - 5, w - 1, h - 5)
span = self.maximum() - self.minimum()
if span == 0:
x = 1
else:
x = (w - 2) * (self.value() - self.minimum()) / span + 1
pen = QPen(QColor(130, 130, 130), 3,
Qt.SolidLine)
qp.setPen(pen)
pen = QPen(QColor(0, 0, 0), 3,
Qt.SolidLine)
qp.drawLine(1, h - 5, x, h - 5)
qp.setPen(pen)
qp.drawLine(x, h - 5, x, h - 5)
#
# qp.setPen(pen)
# qp.setBrush(Qt.NoBrush)
# qp.drawRect(0, 0, w-1, h-1)
#
# j = 0
#
# for i in range(step, 10*step, step):
#
# qp.drawLine(i, 0, i, 5)
# metrics = qp.fontMetrics()
# fw = metrics.width(str(self.num[j]))
# qp.drawText(i-fw/2, h/2, str(self.num[j]))
# j = j + 1
for marker in self._markers:
marker.draw(qp)
评论列表
文章目录