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


Python QSize.scale方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QSize.scale方法的典型用法代码示例。如果您正苦于以下问题:Python QSize.scale方法的具体用法?Python QSize.scale怎么用?Python QSize.scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QSize的用法示例。


在下文中一共展示了QSize.scale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: paintEvent

# 需要导入模块: from PyQt4.QtCore import QSize [as 别名]
# 或者: from PyQt4.QtCore.QSize import scale [as 别名]
    def paintEvent(self, event):
        crect = self.rect()
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)

        painter.setBrush(QBrush(Qt.white))
        painter.setPen(QPen(Qt.lightGray, 1.2))
        painter.drawRoundedRect(QRectF(crect).adjusted(2, 2, -2, -2), 2, 2,
                                Qt.AbsoluteSize)

        if self._selected:
            painter.setPen(QPen(QBrush(Qt.red), 2))
        if self._highlighted:
            painter.setBrush(QBrush(Qt.gray,  Qt.FDiagPattern))
        else:
            painter.setBrush(Qt.NoBrush)

        painter.drawRoundedRect(QRectF(crect).adjusted(2, 2, -2, -2), 2, 2,
                                Qt.AbsoluteSize)

        defsize = self.renderer().defaultSize()
        margin = 5

        bound = QSize(defsize)
        bound.scale(crect.width() - margin, crect.height() - margin,
                    Qt.KeepAspectRatio)

        svgrect = QRectF(0, 0, bound.width(), bound.height())
        svgrect.moveCenter(crect.center())
        self.renderer().render(painter, svgrect)
开发者ID:JakaKokosar,项目名称:orange-bio,代码行数:32,代码来源:OWMoleculeVisualizer.py

示例2: paintEvent

# 需要导入模块: from PyQt4.QtCore import QSize [as 别名]
# 或者: from PyQt4.QtCore.QSize import scale [as 别名]
	def paintEvent(self, event):
		painter = QPainter(self)
		painter.setRenderHint(QPainter.Antialiasing)
		size = QSize(1, 1)
		size.scale(self.width() - 1, self.height() - 1, Qt.KeepAspectRatio)

		matrix = QMatrix()
		matrix.translate((self.width() - size.width()) / 2, (self.height() - size.height()) / 2)
		painter.setMatrix(matrix)
		self.__startAngle = 0
		for polozka in self.__polozky:
			self.kresliPolozku(painter, size, polozka[0], polozka[1], polozka[2])
		self.__startAngle = 0
		for polozka in self.__polozky:
			self.kresliText(painter, size, polozka[0], polozka[1], polozka[2])
开发者ID:mireq,项目名称:pyboincgui,代码行数:17,代码来源:piechart.py


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