本文整理汇总了Python中PyQt4.QtCore.QTimeLine.setEasingCurve方法的典型用法代码示例。如果您正苦于以下问题:Python QTimeLine.setEasingCurve方法的具体用法?Python QTimeLine.setEasingCurve怎么用?Python QTimeLine.setEasingCurve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QTimeLine
的用法示例。
在下文中一共展示了QTimeLine.setEasingCurve方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QPageWidget
# 需要导入模块: from PyQt4.QtCore import QTimeLine [as 别名]
# 或者: from PyQt4.QtCore.QTimeLine import setEasingCurve [as 别名]
#.........这里部分代码省略.........
self.__pages.append(page)
self.layout.addWidget(page.widget)
# Add __tmp_page to end
self.__pages.append(self.__tmp_page)
self.layout.addWidget(self.__tmp_page.widget)
# Create connections for page navigation signals from new page
self.connect(page.widget, SIGNAL("pageNext()"), self.next)
self.connect(page.widget, SIGNAL("pagePrevious()"), self.prev)
self.connect(page.widget, SIGNAL("setCurrent(int)"), self.setCurrent)
def __setCurrent(self, pageNumber):
""" Internal method to set current page index. """
self.__last = self.__current
self.__current = min(max(0, pageNumber), len(self.__pages) - 2)
if pageNumber == len(self.__pages) - 1 and self.__return_to_first:
self.__current = 0
def setCurrent(self, pageNumber = 0):
""" Set and flip the page with given pageNumber.
pageNumber: index number of Page (default is 0)
"""
self.__setCurrent(pageNumber)
self.flipPage()
def getCurrent(self):
""" Returns current page index. """
return self.__current
def getCurrentWidget(self):
""" Returns current page widget. """
return self.getWidget(self.getCurrent())
def getWidget(self, pageNumber):
""" Returns widget for given page index
pageNumber: index number of Page
"""
try:
return self.__pages[pageNumber].widget
except:
return None
def count(self):
""" Returns number of pages. """
return len(self.__pages) - 1
def setAnimation(self, animation = 35):
""" Set the transition animation with the given animation.
animation: the number represents predefined QEasingCurves
List of predefined QEasingCurves can be found from:
http://doc.qt.nokia.com/4/qeasingcurve.html#Type-enum
Default is QEasingCurve::InOutBack (35)
"""
self.__animation = animation
self.__timeline.setEasingCurve(QEasingCurve(self.__animation))
def setDuration(self, duration = 400):
""" Set the transition duration.
duration: duration time in ms
"""
self.__duration = duration
self.__timeline.setDuration(self.__duration)
def flipPage(self, direction=0):
""" Flip the page with given direction.
direction: can be -1, 0 or +1
-1: previous page (if exists)
0: just flip to current page
+1: next page (if exists)
"""
# Enable all widgets
for page in self.__pages:
page.widget.setEnabled(True)
# Check given direction
direction = direction if direction == 0 else max(min(1, direction), -1)
# If direction is equal to zero no need to re-set current
if not direction == 0:
self.__setCurrent(self.__current + direction)
# If last page is different from new page, flip it !
if not self.__last == self.__current:
self.__timeline.setFrameRange(self.__scrollBar.value(), self.__current * self.__base_value())
self.__timeline.start()
def next(self):
""" Helper method to flip next page. """
self.flipPage(1)
def prev(self):
""" Helper method to flip previous page. """
self.flipPage(-1)