本文整理匯總了Python中qwt.qt.QtCore.QRectF.setRect方法的典型用法代碼示例。如果您正苦於以下問題:Python QRectF.setRect方法的具體用法?Python QRectF.setRect怎麽用?Python QRectF.setRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qwt.qt.QtCore.QRectF
的用法示例。
在下文中一共展示了QRectF.setRect方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: renderTo
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setRect [as 別名]
def renderTo(self, plot, dest):
"""
Render a plot to a file
Supported formats are:
- pdf: Portable Document Format PDF
- ps: Postcript
- svg: Scalable Vector Graphics SVG
- all image formats supported by Qt, see QImageWriter.supportedImageFormats()
Scalable vector graphic formats like PDF or SVG are superior to
raster graphics formats.
:param qwt.plot.QwtPlot plot: Plot widget
:param str fileName: Path of the file, where the document will be stored
:param str format: Format for the document
:param QSizeF sizeMM: Size for the document in millimeters.
:param int resolution: Resolution in dots per Inch (dpi)
.. seealso::
:py:meth:`renderTo()`, :py:meth:`render()`,
:py:meth:`qwt.painter.QwtPainter.setRoundingAlignment()`
"""
if isinstance(dest, QPaintDevice):
w = dest.width()
h = dest.height()
rect = QRectF(0, 0, w, h)
elif isinstance(dest, QPrinter):
w = dest.width()
h = dest.height()
rect = QRectF(0, 0, w, h)
aspect = rect.width()/rect.height()
if aspect < 1.:
rect.setHeight(aspect*rect.width())
elif isinstance(dest, QSvgGenerator):
rect = dest.viewBoxF()
if rect.isEmpty():
rect.setRect(0, 0, dest.width(), dest.height())
if rect.isEmpty():
rect.setRect(0, 0, 800, 600)
p = QPainter(dest)
self.render(plot, p, rect)
示例2: renderTo
# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setRect [as 別名]
def renderTo(self, plot, dest):
if isinstance(dest, QPaintDevice):
w = dest.width()
h = dest.height()
rect = QRectF(0, 0, w, h)
elif isinstance(dest, QPrinter):
w = dest.width()
h = dest.height()
rect = QRectF(0, 0, w, h)
aspect = rect.width()/rect.height()
if aspect < 1.:
rect.setHeight(aspect*rect.width())
elif isinstance(dest, QSvgGenerator):
rect = dest.viewBoxF()
if rect.isEmpty():
rect.setRect(0, 0, dest.width(), dest.height())
if rect.isEmpty():
rect.setRect(0, 0, 800, 600)
p = QPainter(dest)
self.render(plot, p, rect)