PythonQt.QtCore.QTimeLine
QTimeLine
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
It's most commonly used to animate a GUI control by calling a slot periodically. You can construct a timeline by passing its duration in milliseconds to QTimeLine's constructor. The timeline's duration describes for how long the animation will run. Then you set a suitable frame range by calling setFrameRange(). Finally connect the frameChanged() signal to a suitable slot in the widget you wish to animate (for example, setValue() in QProgressBar). When you proceed to calling start(), QTimeLine will enter Running state, and start emitting frameChanged() at regular intervals, causing your widget's connected property's value to grow from the lower end to the upper and of your frame range, at a steady rate. You can specify the update interval by calling setUpdateInterval(). When done, QTimeLine enters NotRunning state, and emits finished().
Example:
...
progressBar = new QProgressBar(this);
progressBar->setRange(0, 100);
// Construct a 1-second timeline with a frame range of 0 - 100
QTimeLine *timeLine = new QTimeLine(1000, this);
timeLine->setFrameRange(0, 100);
connect(timeLine, &QTimeLine::frameChanged, progressBar, &QProgressBar::setValue);
// Clicking the push button will start the progress bar animation
pushButton = new QPushButton(tr("Start animation"), this);
connect(pushButton, &QPushButton::clicked, timeLine, &QTimeLine::start);
...
By default the timeline runs once, from its beginning to its end, upon which you must call start() again to restart from the beginning. To make the timeline loop, you can call setLoopCount(), passing the number of times the timeline should run before finishing. The direction can also be changed, causing the timeline to run backward, by calling setDirection(). You can also pause and unpause the timeline while it's running by calling setPaused(). For interactive control, the setCurrentTime() function is provided, which sets the time position of the time line directly. Although most useful in NotRunning state (e.g., connected to a valueChanged() signal in a QSlider), this function can be called at any time.
The frame interface is useful for standard widgets, but QTimeLine can be used to control any type of animation. The heart of QTimeLine lies in the valueForTime() function, which generates a value between 0 and 1 for a given time. This value is typically used to describe the steps of an animation, where 0 is the first step of an animation, and 1 is the last step. When running, QTimeLine generates values between 0 and 1 by calling valueForTime() and emitting valueChanged(). By default, valueForTime() applies an interpolation algorithm to generate these value. You can choose from a set of predefined timeline algorithms by calling setEasingCurve().
Note that, by default, QTimeLine uses QEasingCurve::InOutSine, which provides a value that grows slowly, then grows steadily, and finally grows slowly. For a custom timeline, you can reimplement valueForTime(), in which case QTimeLine's easingCurve property is ignored.
Source: https://doc.qt.io/archives/qt-5.15/qtimeline.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
Backward |
attribute | Any |
(shared captured text) |
CosineCurve |
attribute | Any |
(shared captured text) |
CurveShape |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. |
Direction |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
EaseInCurve |
attribute | Any |
|
EaseInOutCurve |
attribute | Any |
|
EaseOutCurve |
attribute | Any |
|
Forward |
attribute | Any |
(shared captured text) |
LinearCurve |
attribute | Any |
|
NotRunning |
attribute | Any |
(shared captured text) |
Paused |
attribute | Any |
(shared captured text) |
Running |
attribute | Any |
(shared captured text) |
SineCurve |
attribute | Any |
(shared captured text) |
State |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
blockSignals |
function | (self, b: Any) -> bool |
X.blockSignals(b) -> bool (shared captured text) |
childEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
children |
function | (self) -> tuple |
X.children() -> tuple (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
currentFrame |
function | (self) -> int |
X.currentFrame() -> int |
currentTime |
attribute | int |
This property holds the current time of the time line. |
currentValue |
function | (self) -> float |
X.currentValue() -> float |
curveShape |
attribute | Any |
|
customEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
deleteLater |
function | (self) -> Any |
(shared captured text) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.destroyed; argument details are not documented. |
direction |
attribute | Any |
This property holds the direction of the timeline when [QTimeLine](https://doc.qt.io/archives/qt-5.15/qtimeline.html) is in [Running](https://doc.qt.io/archives/qt-5.15/qtimeline.html#State-enum)… |
disconnect |
function | (self, signal: Any, receiver: Any, slot: Any) -> bool |
X.disconnect(signal, receiver, slot) -> bool (shared captured text) |
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
duration |
attribute | int |
This property holds the total duration of the timeline in milliseconds. |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
easingCurve |
attribute | QEasingCurve |
Specifies the easing curve that the timeline will use. |
endFrame |
function | (self) -> int |
X.endFrame() -> int |
event |
function | (self, event: Any) -> bool |
X.event(event) -> bool (shared captured text) |
eventFilter |
function | (self, watched: Any, event: Any) -> bool |
X.eventFilter(watched, event) -> bool (shared captured text) |
findChild |
function | (self, type: Any, name: Any) -> Any |
X.findChild(type, name) -> PythonQt.private.QObject (shared captured text) |
findChildren |
function | (self, type: Any, name: Any) -> tuple |
X.findChildren(type, name) -> tuple (shared captured text) |
finished |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.finished; argument details are not documented. |
frameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.frameChanged; argument details are not documented. |
frameForTime |
function | (self, msec: int) -> int |
X.frameForTime(msec) -> int |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindowType |
function | (self) -> bool |
X.isWindowType() -> bool (shared captured text) |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
loopCount |
attribute | int |
This property holds the number of times the timeline should loop before it's finished. |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
moveToThread |
function | (self, thread: Any) -> Any |
(shared captured text) |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.objectNameChanged; argument details are not documented. |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
resume |
function | (self) -> None |
Resumes the timeline from the current time. |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setCurrentTime |
function | (self, msec: int) -> None |
|
setCurveShape |
function | (self, shape: Any) -> None |
|
setDirection |
function | (self, direction: Any) -> None |
|
setDuration |
function | (self, duration: int) -> None |
|
setEasingCurve |
function | (self, curve: Any) -> None |
|
setEndFrame |
function | (self, frame: int) -> None |
Sets the end frame, which is the frame corresponding to the end of the timeline (i.e., the frame for which the current value is 1), to frame. |
setFrameRange |
function | (self, startFrame: int, endFrame: int) -> None |
X.setFrameRange(startFrame, endFrame) |
setLoopCount |
function | (self, count: int) -> None |
|
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setPaused |
function | (self, paused: bool) -> None |
If paused is true, the timeline is paused, causing [QTimeLine](https://doc.qt.io/archives/qt-5.15/qtimeline.html) to enter Paused state. |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setStartFrame |
function | (self, frame: int) -> None |
Sets the start frame, which is the frame corresponding to the start of the timeline (i.e., the frame for which the current value is 0), to frame. |
setUpdateInterval |
function | (self, interval: int) -> None |
|
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
start |
function | (self) -> None |
Starts the timeline. |
startFrame |
function | (self) -> int |
X.startFrame() -> int |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
state |
function | (self) -> Any |
Returns the state of the timeline. |
stateChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.stateChanged; argument details are not documented. |
stop |
function | (self) -> None |
Stops the timeline, causing [QTimeLine](https://doc.qt.io/archives/qt-5.15/qtimeline.html) to enter [NotRunning](https://doc.qt.io/archives/qt-5.15/qtimeline.html#State-enum) state. |
thread |
function | (self) -> Any |
(shared captured text) |
timerEvent |
function | (self, event: Any) -> None |
Reimplements: [QObject::timerEvent](https://doc.qt.io/archives/qt-5.15/qobject.html#timerEvent)(QTimerEvent *event). |
toggleDirection |
function | (self) -> None |
Toggles the direction of the timeline. |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |
updateInterval |
attribute | int |
This property holds the time in milliseconds between each time [QTimeLine](https://doc.qt.io/archives/qt-5.15/qtimeline.html) updates its current time. |
valueChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.QtCore.QTimeLine.valueChanged; argument details are not documented. |
valueForTime |
function | (self, msec: int) -> float |
X.valueForTime(msec) -> float |