本文整理匯總了Python中qwt.qt.QtCore.QRectF.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Python QRectF.setWidth方法的具體用法?Python QRectF.setWidth怎麽用?Python QRectF.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qwt.qt.QtCore.QRectF
的用法示例。
在下文中一共展示了QRectF.setWidth方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: layoutLegend
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setWidth [as 別名]
def layoutLegend(self, options, rect):
"""
Find the geometry for the legend
:param options: Options how to layout the legend
:param QRectF rect: Rectangle where to place the legend
:return: Geometry for the legend
"""
hint = self.__data.layoutData.legend.hint
if self.__data.legendPos in (QwtPlot.LeftLegend, QwtPlot.RightLegend):
dim = min([hint.width(), int(rect.width()*self.__data.legendRatio)])
if not (options & self.IgnoreScrollbars):
if hint.height() > rect.height():
dim += self.__data.layoutData.legend.hScrollExtent
else:
dim = min([hint.height(), int(rect.height()*self.__data.legendRatio)])
dim = max([dim, self.__data.layoutData.legend.vScrollExtent])
legendRect = QRectF(rect)
if self.__data.legendPos == QwtPlot.LeftLegend:
legendRect.setWidth(dim)
elif self.__data.legendPos == QwtPlot.RightLegend:
legendRect.setX(rect.right()-dim)
legendRect.setWidth(dim)
elif self.__data.legendPos == QwtPlot.TopLegend:
legendRect.setHeight(dim)
elif self.__data.legendPos == QwtPlot.BottomLegend:
legendRect.setY(rect.bottom()-dim)
legendRect.setHeight(dim)
return legendRect
示例2: colorBarRect
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setWidth [as 別名]
def colorBarRect(self, rect):
"""
Calculate the the rectangle for the color bar
:param QRectF rect: Bounding rectangle for all components of the scale
:return: Rectangle for the color bar
"""
cr = QRectF(rect)
if self.__data.scaleDraw.orientation() == Qt.Horizontal:
cr.setLeft(cr.left() + self.__data.borderDist[0])
cr.setWidth(cr.width() - self.__data.borderDist[1] + 1)
else:
cr.setTop(cr.top() + self.__data.borderDist[0])
cr.setHeight(cr.height() - self.__data.borderDist[1] + 1)
sda = self.__data.scaleDraw.alignment()
if sda == QwtScaleDraw.LeftScale:
cr.setLeft(cr.right()-self.__data.margin-self.__data.colorBar.width)
cr.setWidth(self.__data.colorBar.width)
elif sda == QwtScaleDraw.RightScale:
cr.setLeft(cr.left()+self.__data.margin)
cr.setWidth(self.__data.colorBar.width)
elif sda == QwtScaleDraw.BottomScale:
cr.setTop(cr.top()+self.__data.margin)
cr.setHeight(self.__data.colorBar.width)
elif sda == QwtScaleDraw.TopScale:
cr.setTop(cr.bottom()-self.__data.margin-self.__data.colorBar.width)
cr.setHeight(self.__data.colorBar.width)
return cr
示例3: layoutLegend
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setWidth [as 別名]
def layoutLegend(self, options, rect):
hint = self.__data.layoutData.legend.hint
if self.__data.legendPos in (QwtPlot.LeftLegend, QwtPlot.RightLegend):
dim = min([hint.width(), int(rect.width()*self.__data.legendRatio)])
if not (options & self.IgnoreScrollbars):
if hint.height() > rect.height():
dim += self.__data.layoutData.legend.hScrollExtent
else:
dim = min([hint.height(), int(rect.height()*self.__data.legendRatio)])
dim = max([dim, self.__data.layoutData.legend.vScrollExtent])
legendRect = QRectF(rect)
if self.__data.legendPos == QwtPlot.LeftLegend:
legendRect.setWidth(dim)
elif self.__data.legendPos == QwtPlot.RightLegend:
legendRect.setX(rect.right()-dim)
legendRect.setWidth(dim)
elif self.__data.legendPos == QwtPlot.TopLegend:
legendRect.setHeight(dim)
elif self.__data.legendPos == QwtPlot.BottomLegend:
legendRect.setY(rect.bottom()-dim)
legendRect.setHeight(dim)
return legendRect
示例4: colorBarRect
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setWidth [as 別名]
def colorBarRect(self, rect):
cr = QRectF(rect)
if self.__data.scaleDraw.orientation() == Qt.Horizontal:
cr.setLeft(cr.left() + self.__data.borderDist[0])
cr.setWidth(cr.width() - self.__data.borderDist[1] + 1)
else:
cr.setTop(cr.top() + self.__data.borderDist[0])
cr.setHeight(cr.height() - self.__data.borderDist[1] + 1)
sda = self.__data.scaleDraw.alignment()
if sda == QwtScaleDraw.LeftScale:
cr.setLeft(cr.right()-self.__data.margin-self.__data.colorBar.width)
cr.setWidth(self.__data.colorBar.width)
elif sda == QwtScaleDraw.RightScale:
cr.setLeft(cr.left()+self.__data.margin)
cr.setWidth(self.__data.colorBar.width)
elif sda == QwtScaleDraw.BottomScale:
cr.setTop(cr.top()+self.__data.margin)
cr.setHeight(self.__data.colorBar.width)
elif sda == QwtScaleDraw.TopScale:
cr.setTop(cr.bottom()-self.__data.margin-self.__data.colorBar.width)
cr.setHeight(self.__data.colorBar.width)
return cr