本文整理汇总了Python中PyQt4.QtGui.QTransform.fromScale方法的典型用法代码示例。如果您正苦于以下问题:Python QTransform.fromScale方法的具体用法?Python QTransform.fromScale怎么用?Python QTransform.fromScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QTransform
的用法示例。
在下文中一共展示了QTransform.fromScale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resizeEvent
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import fromScale [as 别名]
def resizeEvent(self, event):
w = self.view.width() - 10
h = self.view.height() - 10
transform = QTransform.fromScale(w, h)
self.view.setTransform(transform)
QWidget.resizeEvent(self, event)
示例2: trigger
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import fromScale [as 别名]
def trigger(self, ui):
"""
Trigger this animation
"""
glyph = [glyph for glyph in ui.scene.items()
if hasattr(glyph, 'entity') and glyph.entity == self.mover][0]
if self.direction in (2, 3, 4):
self.flipped = True
self.offset = 32
if self.direction in (6, 7, 8):
self.flipped = False
self.offset = 0
if self.flipped:
glyph.flipped = True
glyph.setTransform(QTransform.fromScale(-1, 1))
else:
glyph.flipped = False
glyph.setTransform(QTransform.fromScale(1, 1))
if glyph.entity.artificial_intelligence:
adapter = MapGlyphAdapter(ui, glyph)
else:
adapter = MapGlyphAdapter(ui, glyph, True)
animation = QParallelAnimationGroup()
move_y = QPropertyAnimation(adapter, 'y_location')
move_y.setDuration(100)
move_y.setStartValue(self.start[1] * 32)
move_y.setEndValue(self.destination[1] * 32)
move_x = QPropertyAnimation(adapter, 'x_location')
move_x.setDuration(100)
move_x.setStartValue(self.start[0] * 32 + self.offset)
move_x.setEndValue(self.destination[0] * 32 + self.offset)
animation.addAnimation(move_y)
animation.addAnimation(move_x)
ui.animations.append(animation)
animation.finished.connect(ui.remove_finished_animation)
animation.start()
示例3: wheelEvent
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import fromScale [as 别名]
def wheelEvent( self, event ):
""" Mouse wheel event """
if QApplication.keyboardModifiers() == Qt.ControlModifier:
factor = 1.41 ** ( -event.delta() / 240.0 )
self.__currentFactor *= factor
self.setTransform( QTransform.fromScale( self.__currentFactor,
self.__currentFactor ) )
Settings().flowScale = self.__currentFactor
else:
QGraphicsView.wheelEvent( self, event )
return
示例4: _setup_scene
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import fromScale [as 别名]
def _setup_scene(self):
self._clear_plot()
self.matrix_item = DistanceMapItem(self._sorted_matrix)
# Scale the y axis to compensate for pg.ViewBox's y axis invert
self.matrix_item.setTransform(QTransform.fromScale(1, -1), )
self.viewbox.addItem(self.matrix_item)
# Set fixed view box range.
h, w = self._sorted_matrix.shape
self.viewbox.setRange(QRectF(0, -h, w, h), padding=0)
self.matrix_item.selectionChanged.connect(self._invalidate_selection)
if self.sorting == OWDistanceMap.NoOrdering:
tree = None
elif self.sorting == OWDistanceMap.Clustering:
tree = self._cluster_tree()
elif self.sorting == OWDistanceMap.OrderedClustering:
tree = self._ordered_cluster_tree()
self._set_displayed_dendrogram(tree)
self._update_color()
示例5: zoomTo
# 需要导入模块: from PyQt4.QtGui import QTransform [as 别名]
# 或者: from PyQt4.QtGui.QTransform import fromScale [as 别名]
def zoomTo( self, scale ):
" Zooms to the specific factor "
self.__currentFactor = scale
self.setTransform( QTransform.fromScale( self.__currentFactor,
self.__currentFactor ) )
return