本文整理汇总了Python中qwt.qt.QtCore.QRectF.toAlignedRect方法的典型用法代码示例。如果您正苦于以下问题:Python QRectF.toAlignedRect方法的具体用法?Python QRectF.toAlignedRect怎么用?Python QRectF.toAlignedRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.qt.QtCore.QRectF
的用法示例。
在下文中一共展示了QRectF.toAlignedRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawLines
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import toAlignedRect [as 别名]
def drawLines(self, painter, xMap, yMap, canvasRect, from_, to):
"""
Draw lines
:param QPainter painter: Painter
:param qwt.scale_map.QwtScaleMap xMap: Maps x-values into pixel coordinates.
:param qwt.scale_map.QwtScaleMap yMap: Maps y-values into pixel coordinates.
:param QRectF canvasRect: Contents rectangle of the canvas
:param int from_: Index of the first point to be painted
:param int to: Index of the last point to be painted. If to < 0 the curve will be painted to its last point.
.. seealso::
:py:meth:`draw()`, :py:meth:`drawDots()`,
:py:meth:`drawSteps()`, :py:meth:`drawSticks()`
"""
if from_ > to:
return
doAlign = QwtPainter.roundingAlignment(painter)
doFill = self.__data.brush.style() != Qt.NoBrush\
and self.__data.brush.color().alpha() > 0
clipRect = QRectF()
if self.__data.paintAttributes & self.ClipPolygons:
pw = max([1., painter.pen().widthF()])
clipRect = canvasRect.adjusted(-pw, -pw, pw, pw)
doIntegers = False
if QT_VERSION < 0x040800:
if painter.paintEngine().type() == QPaintEngine.Raster:
if not doFill:
doIntegers = True
noDuplicates = self.__data.paintAttributes & self.FilterPoints
mapper = QwtPointMapper()
mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
mapper.setFlag(QwtPointMapper.WeedOutPoints, noDuplicates)
mapper.setBoundingRect(canvasRect)
if doIntegers:
polyline = mapper.toPolygon(xMap, yMap, self.data(), from_, to)
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygon(clipRect.toAlignedRect(),
polyline, False)
QwtPainter.drawPolyline(painter, polyline)
else:
polyline = mapper.toPolygonF(xMap, yMap, self.data(), from_, to)
if doFill:
if painter.pen().style() != Qt.NoPen:
filled = QPolygonF(polyline)
self.fillCurve(painter, xMap, yMap, canvasRect, filled)
filled.clear()
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygonF(clipRect,
polyline, False)
QwtPainter.drawPolyline(painter, polyline)
else:
self.fillCurve(painter, xMap, yMap, canvasRect, polyline)
else:
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygonF(clipRect, polyline,
False)
QwtPainter.drawPolyline(painter, polyline)
示例2: drawLines
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import toAlignedRect [as 别名]
def drawLines(self, painter, xMap, yMap, canvasRect, from_, to):
if from_ > to:
return
doAlign = QwtPainter.roundingAlignment(painter)
doFit = (self.__data.attributes & self.Fitted)\
and self.__data.curveFitter
doFill = self.__data.brush.style() != Qt.NoBrush\
and self.__data.brush.color().alpha() > 0
clipRect = QRectF()
if self.__data.paintAttributes & self.ClipPolygons:
pw = max([1., painter.pen().widthF()])
clipRect = canvasRect.adjusted(-pw, -pw, pw, pw)
doIntegers = False
if QT_VERSION < 0x040800:
if painter.paintEngine().type() == QPaintEngine.Raster:
if not doFit and not doFill:
doIntegers = True
noDuplicates = self.__data.paintAttributes & self.FilterPoints
mapper = QwtPointMapper()
mapper.setFlag(QwtPointMapper.RoundPoints, doAlign)
mapper.setFlag(QwtPointMapper.WeedOutPoints, noDuplicates)
mapper.setBoundingRect(canvasRect)
if doIntegers:
polyline = mapper.toPolygon(xMap, yMap, self.data(), from_, to)
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygon(clipRect.toAlignedRect(),
polyline, False)
QwtPainter.drawPolyline(painter, polyline)
else:
polyline = mapper.toPolygonF(xMap, yMap, self.data(), from_, to)
if doFit:
polyline = self.__data.curveFitter.fitCurve(polyline)
if doFill:
if painter.pen().style() != Qt.NoPen:
filled = QPolygonF(polyline)
self.fillCurve(painter, xMap, yMap, canvasRect, filled)
filled.clear()
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygonF(clipRect,
polyline, False)
QwtPainter.drawPolyline(painter, polyline)
else:
self.fillCurve(painter, xMap, yMap, canvasRect, polyline)
else:
if self.__data.paintAttributes & self.ClipPolygons:
polyline = QwtClipper().clipPolygonF(clipRect, polyline,
False)
QwtPainter.drawPolyline(painter, polyline)