本文整理汇总了Python中qwt.painter.QwtPainter.drawFrame方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPainter.drawFrame方法的具体用法?Python QwtPainter.drawFrame怎么用?Python QwtPainter.drawFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.painter.QwtPainter
的用法示例。
在下文中一共展示了QwtPainter.drawFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: renderCanvas
# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawFrame [as 别名]
def renderCanvas(self, plot, painter, canvasRect, maps):
canvas = plot.canvas()
r = canvasRect.adjusted(0., 0., -1., 1.)
if self.__data.layoutFlags & self.FrameWithScales:
painter.save()
r.adjust(-1., -1., 1., 1.)
painter.setPen(QPen(Qt.black))
if not (self.__data.discardFlags & self.DiscardCanvasBackground):
bgBrush = canvas.palette().brush(plot.backgroundRole())
painter.setBrush(bgBrush)
QwtPainter.drawRect(painter, r)
painter.restore()
painter.save()
painter.setClipRect(canvasRect)
plot.drawItems(painter, canvasRect, maps)
painter.restore()
elif canvas.testAttribute(Qt.WA_StyledBackground):
clipPath = QPainterPath()
painter.save()
if not self.__data.discardFlags & self.DiscardCanvasBackground:
QwtPainter.drawBackground(painter, r, canvas)
clipPath = qwtCanvasClip(canvas, canvasRect)
painter.restore()
painter.save()
if clipPath.isEmpty():
painter.setClipRect(canvasRect)
else:
painter.setClipPath(clipPath)
plot.drawItems(painter, canvasRect, maps)
painter.restore()
else:
clipPath = QPainterPath()
frameWidth = 0
if not self.__data.discardFlags & self.DiscardCanvasFrame:
frameWidth = canvas.frameWidth()
clipPath = qwtCanvasClip(canvas, canvasRect)
innerRect = canvasRect.adjusted(frameWidth, frameWidth,
-frameWidth, -frameWidth)
painter.save()
if clipPath.isEmpty():
painter.setClipRect(innerRect)
else:
painter.setClipPath(clipPath)
if not self.__data.discardFlags & self.DiscardCanvasBackground:
QwtPainter.drawBackground(painter, innerRect, canvas)
plot.drawItems(painter, innerRect, maps)
painter.restore()
if frameWidth > 0:
painter.save()
frameStyle = canvas.frameShadow() | canvas.frameShape()
frameWidth = canvas.frameWidth()
borderRadius = canvas.borderRadius()
if borderRadius > 0.:
QwtPainter.drawRoundedFrame(painter, canvasRect, r, r,
canvas.palette(), frameWidth,
frameStyle)
else:
midLineWidth = canvas.midLineWidth()
QwtPainter.drawFrame(painter, canvasRect, canvas.palette(),
canvas.foregroundRole(), frameWidth,
midLineWidth, frameStyle)
painter.restore()
示例2: renderCanvas
# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawFrame [as 别名]
def renderCanvas(self, plot, painter, canvasRect, maps):
"""
Render the canvas into a given rectangle.
:param qwt.plot.QwtPlot plot: Plot widget
:param QPainter painter: Painter
:param qwt.scale_map.QwtScaleMap maps: mapping between plot and paint device coordinates
:param QRectF rect: Bounding rectangle
"""
canvas = plot.canvas()
r = canvasRect.adjusted(0., 0., -1., 1.)
if self.__data.layoutFlags & self.FrameWithScales:
painter.save()
r.adjust(-1., -1., 1., 1.)
painter.setPen(QPen(Qt.black))
if not (self.__data.discardFlags & self.DiscardCanvasBackground):
bgBrush = canvas.palette().brush(plot.backgroundRole())
painter.setBrush(bgBrush)
painter.drawRect(r)
painter.restore()
painter.save()
painter.setClipRect(canvasRect)
plot.drawItems(painter, canvasRect, maps)
painter.restore()
elif canvas.testAttribute(Qt.WA_StyledBackground):
clipPath = QPainterPath()
painter.save()
if not self.__data.discardFlags & self.DiscardCanvasBackground:
QwtPainter.drawBackground(painter, r, canvas)
clipPath = qwtCanvasClip(canvas, canvasRect)
painter.restore()
painter.save()
if clipPath.isEmpty():
painter.setClipRect(canvasRect)
else:
painter.setClipPath(clipPath)
plot.drawItems(painter, canvasRect, maps)
painter.restore()
else:
clipPath = QPainterPath()
frameWidth = 0
if not self.__data.discardFlags & self.DiscardCanvasFrame:
frameWidth = canvas.frameWidth()
clipPath = qwtCanvasClip(canvas, canvasRect)
innerRect = canvasRect.adjusted(frameWidth, frameWidth,
-frameWidth, -frameWidth)
painter.save()
if clipPath.isEmpty():
painter.setClipRect(innerRect)
else:
painter.setClipPath(clipPath)
if not self.__data.discardFlags & self.DiscardCanvasBackground:
QwtPainter.drawBackground(painter, innerRect, canvas)
plot.drawItems(painter, innerRect, maps)
painter.restore()
if frameWidth > 0:
painter.save()
frameStyle = canvas.frameShadow() | canvas.frameShape()
frameWidth = canvas.frameWidth()
borderRadius = canvas.borderRadius()
if borderRadius > 0.:
QwtPainter.drawRoundedFrame(painter, canvasRect, r, r,
canvas.palette(), frameWidth,
frameStyle)
else:
midLineWidth = canvas.midLineWidth()
QwtPainter.drawFrame(painter, canvasRect, canvas.palette(),
canvas.foregroundRole(), frameWidth,
midLineWidth, frameStyle)
painter.restore()