本文整理汇总了Python中PyQt4.QtCore.QPropertyAnimation.pause方法的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation.pause方法的具体用法?Python QPropertyAnimation.pause怎么用?Python QPropertyAnimation.pause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.pause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NodeBodyItem
# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import pause [as 别名]
#.........这里部分代码省略.........
def hoverLeaveEvent(self, event):
self.__hover = False
self.__updateShadowState()
return GraphicsPathObject.hoverLeaveEvent(self, event)
def paint(self, painter, option, widget):
"""
Paint the shape and a progress meter.
"""
# Let the default implementation draw the shape
if option.state & QStyle.State_Selected:
# Prevent the default bounding rect selection indicator.
option.state = option.state ^ QStyle.State_Selected
GraphicsPathObject.paint(self, painter, option, widget)
if self.__progress >= 0:
# Draw the progress meter over the shape.
# Set the clip to shape so the meter does not overflow the shape.
painter.setClipPath(self.shape(), Qt.ReplaceClip)
color = self.palette.color(QPalette.ButtonText)
pen = QPen(color, 5)
painter.save()
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing)
span = int(self.__progress * 57.60)
painter.drawArc(self.__shapeRect, 90 * 16, -span)
painter.restore()
def __updateShadowState(self):
if self.__hasFocus:
color = QColor(FOCUS_OUTLINE_COLOR)
self.setPen(QPen(color, 1.5))
else:
self.setPen(QPen(Qt.NoPen))
radius = 3
enabled = False
if self.__isSelected:
enabled = True
radius = 7
if self.__hover:
radius = 17
enabled = True
if enabled and not self.shadow.isEnabled():
self.shadow.setEnabled(enabled)
if self.__animationEnabled:
if self.__blurAnimation.state() == QPropertyAnimation.Running:
self.__blurAnimation.pause()
self.__blurAnimation.setStartValue(self.shadow.blurRadius())
self.__blurAnimation.setEndValue(radius)
self.__blurAnimation.start()
else:
self.shadow.setBlurRadius(radius)
def __updateBrush(self):
palette = self.palette
if self.__isSelected:
cg = QPalette.Active
else:
cg = QPalette.Inactive
palette.setCurrentColorGroup(cg)
c1 = palette.color(QPalette.Light)
c2 = palette.color(QPalette.Button)
grad = radial_gradient(c2, c1)
self.setBrush(QBrush(grad))
# TODO: The selected and focus states should be set using the
# QStyle flags (State_Selected. State_HasFocus)
def setSelected(self, selected):
"""
Set the `selected` state.
.. note:: The item does not have `QGraphicsItem.ItemIsSelectable` flag.
This property is instead controlled by the parent NodeItem.
"""
self.__isSelected = selected
self.__updateBrush()
def setHasFocus(self, focus):
"""
Set the `has focus` state.
.. note:: The item does not have `QGraphicsItem.ItemIsFocusable` flag.
This property is instead controlled by the parent NodeItem.
"""
self.__hasFocus = focus
self.__updateShadowState()
def __on_finished(self):
if self.shadow.blurRadius() == 0:
self.shadow.setEnabled(False)