本文整理汇总了Python中PyQt4.QtCore.QLineF.setP1方法的典型用法代码示例。如果您正苦于以下问题:Python QLineF.setP1方法的具体用法?Python QLineF.setP1怎么用?Python QLineF.setP1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QLineF
的用法示例。
在下文中一共展示了QLineF.setP1方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __activeControlMoved
# 需要导入模块: from PyQt4.QtCore import QLineF [as 别名]
# 或者: from PyQt4.QtCore.QLineF import setP1 [as 别名]
def __activeControlMoved(self, pos):
line = QLineF(self.__line)
control = self.__activeControl
if control.anchor() == ControlPoint.TopLeft:
line.setP1(pos)
elif control.anchor() == ControlPoint.BottomRight:
line.setP2(pos)
if self.__line != line:
self.blockSignals(True)
self.setLine(line)
self.blockSignals(False)
self.lineEdited.emit(line)
示例2: drawPath
# 需要导入模块: from PyQt4.QtCore import QLineF [as 别名]
# 或者: from PyQt4.QtCore.QLineF import setP1 [as 别名]
def drawPath(self, startPoint, endPoint):
path = QPainterPath()
one = (QPointF(endPoint.x(), startPoint.y()) + startPoint) / 2
two = (QPointF(startPoint.x(), endPoint.y()) + endPoint) / 2
path.moveTo(startPoint)
angle = math.pi / 2
bLine1 = QLineF()
bLine1.setP1(startPoint)
if startPoint.x() > endPoint.x():
dist = startPoint.x() - endPoint.x()
one = (bLine1.p1() + QPointF(math.sin(angle) * dist, math.cos(angle) * dist))
bLine1.setP1(endPoint)
two = (bLine1.p1() + QPointF(math.sin(angle) * dist, math.cos(angle) * dist))
path.cubicTo(one, two, endPoint)
return path, QLineF(one, two)