本文整理汇总了Python中qwt.qt.QtCore.QRectF.setRight方法的典型用法代码示例。如果您正苦于以下问题:Python QRectF.setRight方法的具体用法?Python QRectF.setRight怎么用?Python QRectF.setRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.qt.QtCore.QRectF
的用法示例。
在下文中一共展示了QRectF.setRight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qwtBoundingRectT
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import setRight [as 别名]
def qwtBoundingRectT(series, from_, to):
boundingRect = QRectF(1.0, 1.0, -2.0, -2.0)
if from_ < 0:
from_ = 0
if to < 0:
to = series.size() - 1
if to < from_:
return boundingRect
first_stage = True
for i in range(from_, to + 1):
rect = qwtBoundingRect(series.sample(i))
if rect.width() >= 0.0 and rect.height() >= 0.0:
if first_stage:
boundingRect = rect
first_stage = False
continue
else:
boundingRect.setLeft(min([boundingRect.left(), rect.left()]))
boundingRect.setRight(max([boundingRect.right(), rect.right()]))
boundingRect.setTop(min([boundingRect.top(), rect.top()]))
boundingRect.setBottom(max([boundingRect.bottom(), rect.bottom()]))
return boundingRect
示例2: activate
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import setRight [as 别名]
def activate(self, plot, plotRect, options=0x00):
"""
Recalculate the geometry of all components.
:param qwt.plot.QwtPlot plot: Plot to be layout
:param QRectF plotRect: Rectangle where to place the components
:param options: Layout options
"""
self.invalidate()
rect = QRectF(plotRect)
self.__data.layoutData.init(plot, rect)
if not (options & self.IgnoreLegend) and plot.legend() and\
not plot.legend().isEmpty():
self.__data.legendRect = self.layoutLegend(options, rect)
region = QRegion(rect.toRect())
rect = region.subtracted(QRegion(self.__data.legendRect.toRect())
).boundingRect()
if self.__data.legendPos == QwtPlot.LeftLegend:
rect.setLeft(rect.left()+self.__data.spacing)
elif self.__data.legendPos == QwtPlot.RightLegend:
rect.setRight(rect.right()-self.__data.spacing)
elif self.__data.legendPos == QwtPlot.TopLegend:
rect.setTop(rect.top()+self.__data.spacing)
elif self.__data.legendPos == QwtPlot.BottomLegend:
rect.setBottom(rect.bottom()-self.__data.spacing)
# +---+-----------+---+
# | Title |
# +---+-----------+---+
# | | Axis | |
# +---+-----------+---+
# | A | | A |
# | x | Canvas | x |
# | i | | i |
# | s | | s |
# +---+-----------+---+
# | | Axis | |
# +---+-----------+---+
# | Footer |
# +---+-----------+---+
# title, footer and axes include text labels. The height of each
# label depends on its line breaks, that depend on the width
# for the label. A line break in a horizontal text will reduce
# the available width for vertical texts and vice versa.
# expandLineBreaks finds the height/width for title, footer and axes
# including all line breaks.
dimTitle, dimFooter, dimAxes = self.expandLineBreaks(options, rect)
if dimTitle > 0:
self.__data.titleRect.setRect(rect.left(), rect.top(),
rect.width(), dimTitle)
rect.setTop(self.__data.titleRect.bottom()+self.__data.spacing)
if self.__data.layoutData.scale[QwtPlot.yLeft].isEnabled !=\
self.__data.layoutData.scale[QwtPlot.yRight].isEnabled:
self.__data.titleRect.setX(rect.left()+dimAxes[QwtPlot.yLeft])
self.__data.titleRect.setWidth(rect.width()\
-dimAxes[QwtPlot.yLeft]-dimAxes[QwtPlot.yRight])
if dimFooter > 0:
self.__data.footerRect.setRect(rect.left(),
rect.bottom()-dimFooter, rect.width(), dimFooter)
rect.setBottom(self.__data.footerRect.top()-self.__data.spacing)
if self.__data.layoutData.scale[QwtPlot.yLeft].isEnabled !=\
self.__data.layoutData.scale[QwtPlot.yRight].isEnabled:
self.__data.footerRect.setX(rect.left()+dimAxes[QwtPlot.yLeft])
self.__data.footerRect.setWidth(rect.width()\
-dimAxes[QwtPlot.yLeft]-dimAxes[QwtPlot.yRight])
self.__data.canvasRect.setRect(
rect.x()+dimAxes[QwtPlot.yLeft],
rect.y()+dimAxes[QwtPlot.xTop],
rect.width()-dimAxes[QwtPlot.yRight]-dimAxes[QwtPlot.yLeft],
rect.height()-dimAxes[QwtPlot.xBottom]-dimAxes[QwtPlot.xTop])
for axis in QwtPlot.validAxes:
if dimAxes[axis]:
dim = dimAxes[axis]
scaleRect = self.__data.scaleRect[axis]
scaleRect.setRect(*self.__data.canvasRect.getRect())
if axis == QwtPlot.yLeft:
scaleRect.setX(self.__data.canvasRect.left()-dim)
scaleRect.setWidth(dim)
elif axis == QwtPlot.yRight:
scaleRect.setX(self.__data.canvasRect.right())
scaleRect.setWidth(dim)
elif axis == QwtPlot.xBottom:
scaleRect.setY(self.__data.canvasRect.bottom())
scaleRect.setHeight(dim)
elif axis == QwtPlot.xTop:
scaleRect.setY(self.__data.canvasRect.top()-dim)
scaleRect.setHeight(dim)
scaleRect = scaleRect.normalized()
# +---+-----------+---+
# | <- Axis -> |
# +-^-+-----------+-^-+
# | | | | | |
# | | | |
# | A | | A |
# | x | Canvas | x |
# | i | | i |
# | s | | s |
#.........这里部分代码省略.........
示例3: activate
# 需要导入模块: from qwt.qt.QtCore import QRectF [as 别名]
# 或者: from qwt.qt.QtCore.QRectF import setRight [as 别名]
def activate(self, plot, plotRect, options=0x00):
self.invalidate()
rect = QRectF(plotRect)
self.__data.layoutData.init(plot, rect)
if not (options & self.IgnoreLegend) and plot.legend() and\
not plot.legend().isEmpty():
self.__data.legendRect = self.layoutLegend(options, rect)
region = QRegion(rect.toRect())
rect = region.subtracted(QRegion(self.__data.legendRect.toRect())
).boundingRect()
if self.__data.legendPos == QwtPlot.LeftLegend:
rect.setLeft(rect.left()+self.__data.spacing)
elif self.__data.legendPos == QwtPlot.RightLegend:
rect.setRight(rect.right()-self.__data.spacing)
elif self.__data.legendPos == QwtPlot.TopLegend:
rect.setTop(rect.top()+self.__data.spacing)
elif self.__data.legendPos == QwtPlot.BottomLegend:
rect.setBottom(rect.bottom()-self.__data.spacing)
# +---+-----------+---+
# | Title |
# +---+-----------+---+
# | | Axis | |
# +---+-----------+---+
# | A | | A |
# | x | Canvas | x |
# | i | | i |
# | s | | s |
# +---+-----------+---+
# | | Axis | |
# +---+-----------+---+
# | Footer |
# +---+-----------+---+
dimTitle, dimFooter, dimAxes = self.expandLineBreaks(options, rect)
if dimTitle > 0:
self.__data.titleRect.setRect(rect.left(), rect.top(),
rect.width(), dimTitle)
rect.setTop(self.__data.titleRect.bottom()+self.__data.spacing)
if self.__data.layoutData.scale[QwtPlot.yLeft].isEnabled !=\
self.__data.layoutData.scale[QwtPlot.yRight].isEnabled:
self.__data.titleRect.setX(rect.left()+dimAxes[QwtPlot.yLeft])
self.__data.titleRect.setWidth(rect.width()\
-dimAxes[QwtPlot.yLeft]-dimAxes[QwtPlot.yRight])
if dimFooter > 0:
self.__data.footerRect.setRect(rect.left(),
rect.bottom()-dimFooter, rect.width(), dimFooter)
rect.setBottom(self.__data.footerRect.top()-self.__data.spacing)
if self.__data.layoutData.scale[QwtPlot.yLeft].isEnabled !=\
self.__data.layoutData.scale[QwtPlot.yRight].isEnabled:
self.__data.footerRect.setX(rect.left()+dimAxes[QwtPlot.yLeft])
self.__data.footerRect.setWidth(rect.width()\
-dimAxes[QwtPlot.yLeft]-dimAxes[QwtPlot.yRight])
self.__data.canvasRect.setRect(
rect.x()+dimAxes[QwtPlot.yLeft],
rect.y()+dimAxes[QwtPlot.xTop],
rect.width()-dimAxes[QwtPlot.yRight]-dimAxes[QwtPlot.yLeft],
rect.height()-dimAxes[QwtPlot.xBottom]-dimAxes[QwtPlot.xTop])
for axis in range(QwtPlot.axisCnt):
if dimAxes[axis]:
dim = dimAxes[axis]
scaleRect = self.__data.scaleRect[axis]
scaleRect.setRect(*self.__data.canvasRect.getRect())
if axis == QwtPlot.yLeft:
scaleRect.setX(self.__data.canvasRect.left()-dim)
scaleRect.setWidth(dim)
elif axis == QwtPlot.yRight:
scaleRect.setX(self.__data.canvasRect.right())
scaleRect.setWidth(dim)
elif axis == QwtPlot.xBottom:
scaleRect.setY(self.__data.canvasRect.bottom())
scaleRect.setHeight(dim)
elif axis == QwtPlot.xTop:
scaleRect.setY(self.__data.canvasRect.top()-dim)
scaleRect.setHeight(dim)
scaleRect = scaleRect.normalized()
# +---+-----------+---+
# | <- Axis -> |
# +-^-+-----------+-^-+
# | | | | | |
# | | | |
# | A | | A |
# | x | Canvas | x |
# | i | | i |
# | s | | s |
# | | | |
# | | | | | |
# +-V-+-----------+-V-+
# | <- Axis -> |
# +---+-----------+---+
self.alignScales(options, self.__data.canvasRect,
self.__data.scaleRect)
if not self.__data.legendRect.isEmpty():
self.__data.legendRect = self.alignLegend(self.__data.canvasRect,
self.__data.legendRect)