当前位置: 首页>>代码示例>>Python>>正文


Python QRectF.setRect方法代码示例

本文整理汇总了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)
开发者ID:robinkqin,项目名称:PythonQwt,代码行数:46,代码来源:plot_renderer.py

示例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)
开发者ID:petebachant,项目名称:python-qwt,代码行数:22,代码来源:plot_renderer.py


注:本文中的qwt.qt.QtCore.QRectF.setRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。