本文整理汇总了Python中qwt.painter.QwtPainter.drawRoundedFrame方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPainter.drawRoundedFrame方法的具体用法?Python QwtPainter.drawRoundedFrame怎么用?Python QwtPainter.drawRoundedFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.painter.QwtPainter
的用法示例。
在下文中一共展示了QwtPainter.drawRoundedFrame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawBorder
# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawRoundedFrame [as 别名]
def drawBorder(self, painter):
if self.__data.borderRadius > 0:
if self.frameWidth() > 0:
QwtPainter.drawRoundedFrame(painter, QRectF(self.frameRect()),
self.__data.borderRadius, self.__data.borderRadius,
self.palette(), self.frameWidth(), self.frameStyle())
else:
if QT_VERSION >= 0x040500:
if PYQT5:
from qwt.qt.QtGui import QStyleOptionFrame
else:
from qwt.qt.QtGui import QStyleOptionFrameV3 as\
QStyleOptionFrame
opt = QStyleOptionFrame()
opt.initFrom(self)
frameShape = self.frameStyle() & QFrame.Shape_Mask
frameShadow = self.frameStyle() & QFrame.Shadow_Mask
opt.frameShape = QFrame.Shape(int(opt.frameShape)|frameShape)
if frameShape in (QFrame.Box, QFrame.HLine, QFrame.VLine,
QFrame.StyledPanel, QFrame.Panel):
opt.lineWidth = self.lineWidth()
opt.midLineWidth = self.midLineWidth()
else:
opt.lineWidth = self.frameWidth()
if frameShadow == self.Sunken:
opt.state |= QStyle.State_Sunken
elif frameShadow == self.Raised:
opt.state |= QStyle.State_Raised
self.style().drawControl(QStyle.CE_ShapedFrame, opt, painter, self)
else:
self.drawFrame(painter)
示例2: renderCanvas
# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawRoundedFrame [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()
示例3: renderCanvas
# 需要导入模块: from qwt.painter import QwtPainter [as 别名]
# 或者: from qwt.painter.QwtPainter import drawRoundedFrame [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()