本文整理汇总了Python中qwt.qt.QtCore.QRectF.normalized方法的典型用法代码示例。如果您正苦于以下问题:Python QRectF.normalized方法的具体用法?Python QRectF.normalized怎么用?Python QRectF.normalized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.qt.QtCore.QRectF
的用法示例。
在下文中一共展示了QRectF.normalized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setCornerRects
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import normalized [as 别名]
def setCornerRects(self, path):
pos = QPointF(0., 0.)
for i in range(path.elementCount()):
el = path.elementAt(i)
if el.type in (QPainterPath.MoveToElement,
QPainterPath.LineToElement):
pos.setX(el.x)
pos.setY(el.y)
elif el.type == QPainterPath.CurveToElement:
r = QRectF(pos, QPointF(el.x, el.y))
self.clipRects += [r.normalized()]
pos.setX(el.x)
pos.setY(el.y)
elif el.type == QPainterPath.CurveToDataElement:
if self.clipRects:
r = self.clipRects[-1]
r.setCoords(min([r.left(), el.x]),
min([r.top(), el.y]),
max([r.right(), el.x]),
max([r.bottom(), el.y]))
self.clipRects[-1] = r.normalized()
示例2: toRect
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import normalized [as 别名]
def toRect(self):
r = QRectF(self.hInterval.minValue(), self.vInterval.minValue(),
self.hInterval.maxValue()-self.hInterval.minValue(),
self.vInterval.maxValue()-self.vInterval.minValue())
r = r.normalized()
if self.hInterval.borderFlags() & QwtInterval.ExcludeMinimum:
r.adjust(1, 0, 0, 0)
if self.hInterval.borderFlags() & QwtInterval.ExcludeMaximum:
r.adjust(0, 0, -1, 0)
if self.vInterval.borderFlags() & QwtInterval.ExcludeMinimum:
r.adjust(0, 1, 0, 0)
if self.vInterval.borderFlags() & QwtInterval.ExcludeMaximum:
r.adjust(0, 0, 0, -1)
return r
示例3: invTransform
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import normalized [as 别名]
def invTransform(self, *args):
"""Transform from paint to scale coordinates
Scalar: scalemap.invTransform(scalar)
Point (QPointF): scalemap.invTransform(xMap, yMap, pos)
Rectangle (QRectF): scalemap.invTransform(xMap, yMap, rect)
"""
if len(args) == 1:
# Scalar transform
return self.invTransform_scalar(args[0])
elif isinstance(args[2], QPointF):
xMap, yMap, pos = args
return QPointF(xMap.invTransform(pos.x()),
yMap.invTransform(pos.y()))
elif isinstance(args[2], QRectF):
xMap, yMap, rect = args
x1 = xMap.invTransform(rect.left())
x2 = xMap.invTransform(rect.right()-1)
y1 = yMap.invTransform(rect.top())
y2 = yMap.invTransform(rect.bottom()-1)
r = QRectF(x1, y1, x2-x1, y2-y1)
return r.normalized()