本文整理汇总了Python中PyQt4.QtGui.QGraphicsLineItem.setZValue方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsLineItem.setZValue方法的具体用法?Python QGraphicsLineItem.setZValue怎么用?Python QGraphicsLineItem.setZValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsLineItem
的用法示例。
在下文中一共展示了QGraphicsLineItem.setZValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_y_axis
# 需要导入模块: from PyQt4.QtGui import QGraphicsLineItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsLineItem import setZValue [as 别名]
def draw_y_axis(self):
lineItem = QGraphicsLineItem(0, self.coordY(self.ylim[0]),
0, self.coordY(self.ylim[1]),
parent=self.item)
lineItem.setPen(QPen(QColor('black')))
lineItem.setZValue(10)
max_w = 0
for y in set(self.hlines + list(self.ylim)):
lineItem = QGraphicsLineItem(0, self.coordY(y),
-5, self.coordY(y),
parent=self.item)
lineItem.setPen(QPen(QColor('black')))
lineItem.setZValue(10)
text = QGraphicsSimpleTextItem(str(y))
text.setFont(QFont("Arial", self.fsize-2))
text.setParentItem(self.item)
tw = text.boundingRect().width()
max_w = tw if tw > max_w else max_w
th = text.boundingRect().height()
# Center text according to masterItem size
text.setPos(-tw - 5, self.coordY(y)-th/2)
if self.ylabel:
text = QGraphicsSimpleTextItem(self.ylabel)
text.setFont(QFont("Arial", self.fsize-1))
text.setParentItem(self.item)
text.rotate(-90)
tw = text.boundingRect().width()
th = text.boundingRect().height()
# Center text according to masterItem size
text.setPos(-th -5-max_w, tw/2+self.coordY(sum(self.ylim)/2))
示例2: line
# 需要导入模块: from PyQt4.QtGui import QGraphicsLineItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsLineItem import setZValue [as 别名]
def line(x1, y1, x2, y2):
r = QGraphicsLineItem(x1, y1, x2, y2, None)
self.canvas.addItem(r)
r.setPen(QPen(Qt.white, 2))
r.setZValue(30)
示例3: draw_hlines
# 需要导入模块: from PyQt4.QtGui import QGraphicsLineItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsLineItem import setZValue [as 别名]
def draw_hlines (self, line, col):
lineItem = QGraphicsLineItem(0, self.coordY(line),
self.width, self.coordY(line),
parent=self.item)
lineItem.setPen(QPen(QColor(col), 1, Qt.DashLine))
lineItem.setZValue(10)