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


Python QPropertyAnimation.setParent方法代码示例

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


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

示例1: popup

# 需要导入模块: from PyQt4.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt4.QtCore.QPropertyAnimation import setParent [as 别名]
 def popup(self, pos=None):
     """
     Pops up this widget at the inputed position.  The inputed point should \
     be in global space.
     
     :param      pos | <QPoint>
     
     :return     <bool> success
     """
     if self._first and self.centralWidget() is not None:
         self.adjustSize()
         self._first = False
     
     if not self.signalsBlocked():
         self.aboutToShow.emit()
     
     if not pos:
         pos = QCursor.pos()
     
     if self.currentMode() == XPopupWidget.Mode.Dialog and \
          self.isVisible():
         return False
     
     elif self.currentMode() == XPopupWidget.Mode.Dialog:
         self.setPopupMode()
     
     # auto-calculate the point
     if self.autoCalculateAnchor():
         self.setAnchor(self.mapAnchorFrom( self.parent(), pos ))
     
     pad = self.popupPadding()
     
     # determine where to move based on the anchor
     anchor = self.anchor()
     
     # MODIFY X POSITION
     # align x-left
     if ( anchor & (XPopupWidget.Anchor.TopLeft |
                    XPopupWidget.Anchor.BottomLeft) ):
         pos.setX(pos.x() - pad)
     
     # align x-center
     elif ( anchor & (XPopupWidget.Anchor.TopCenter |
                      XPopupWidget.Anchor.BottomCenter) ):
         pos.setX(pos.x() - self.width() / 2)
     
     # align x-right
     elif ( anchor & (XPopupWidget.Anchor.TopRight |
                      XPopupWidget.Anchor.BottomRight) ):
         pos.setX(pos.x() - self.width() + pad)
     
     # align x-padded
     elif ( anchor & (XPopupWidget.Anchor.RightTop |
                      XPopupWidget.Anchor.RightCenter |
                      XPopupWidget.Anchor.RightBottom) ):
         pos.setX(pos.x() - self.width())
     
     # MODIFY Y POSITION
     # align y-top
     if ( anchor & (XPopupWidget.Anchor.LeftTop |
                    XPopupWidget.Anchor.RightTop) ):
         pos.setY(pos.y() - pad)
     
     # align y-center
     elif ( anchor & (XPopupWidget.Anchor.LeftCenter |
                      XPopupWidget.Anchor.RightCenter) ):
         pos.setY(pos.y() - self.height() / 2)
     
     # align y-bottom
     elif ( anchor & (XPopupWidget.Anchor.LeftBottom |
                      XPopupWidget.Anchor.RightBottom) ):
         pos.setY(pos.y() - self.height() + pad)
     
     # align y-padded
     elif ( anchor & (XPopupWidget.Anchor.BottomLeft |
                      XPopupWidget.Anchor.BottomCenter |
                      XPopupWidget.Anchor.BottomRight) ):
         pos.setY(pos.y() - self.height())
     
     self.adjustMask()
     self.move(pos)
     self.update()
     self.setUpdatesEnabled(True)
     
     if self.isAnimated():
         anim = QPropertyAnimation(self, 'windowOpacity')
         anim.setParent(self)
         anim.setStartValue(0.0)
         anim.setEndValue(self.windowOpacity())
         anim.setDuration(500)
         anim.finished.connect(anim.deleteLater)
         self.setWindowOpacity(0.0)
     else:
         anim = None
         
     
     self.show()
     
     if self.currentMode() != XPopupWidget.Mode.ToolTip:
         self.activateWindow()
#.........这里部分代码省略.........
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:103,代码来源:xpopupwidget.py


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