Qyoto
4.0.5
Qyoto is a C# language binding for Qt
|
The QTimeLine class provides a timeline for controlling animations. More...
Public Types | |
enum | CurveShape { CosineCurve = 5, EaseInCurve = 0, EaseInOutCurve = 2, EaseOutCurve = 1, LinearCurve = 3, SineCurve = 4 } |
More... | |
enum | Direction { Backward = 1, Forward = 0 } |
More... | |
enum | State { NotRunning = 0, Paused = 1, Running = 2 } |
More... | |
Public Member Functions | |
QTimeLine (int duration=1000, QObject parent=null) | |
| |
override void | CreateProxy () |
new int | CurrentFrame () |
| |
new double | CurrentValue () |
| |
new int | FrameForTime (int msec) |
| |
new void | Resume () |
| |
new void | SetFrameRange (int startFrame, int endFrame) |
| |
new void | SetPaused (bool paused) |
| |
new void | Start () |
| |
new QTimeLine.State | state () |
| |
new void | Stop () |
| |
new void | ToggleDirection () |
| |
virtual double | ValueForTime (int msec) |
| |
new void | Dispose () |
Public Member Functions inherited from QtCore.QObject | |
QObject (QObject parent=null) | |
| |
new bool | BlockSignals (bool b) |
| |
new System.Collections.Generic.List < QObject > | Children () |
| |
new bool | Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection) |
| |
new void | DeleteLater () |
| |
new bool | Disconnect (QObject receiver, string member=null) |
| |
new bool | Disconnect (string signal=null, QObject receiver=null, string member=null) |
| |
new void | DumpObjectInfo () |
| |
new void | DumpObjectTree () |
| |
new System.Collections.Generic.List < QByteArray > | DynamicPropertyNames () |
| |
virtual bool | OnEvent (QEvent arg1) |
| |
virtual bool | EventFilter (QObject arg1, QEvent arg2) |
| |
new bool | Inherits (string classname) |
| |
new void | InstallEventFilter (QObject arg1) |
| |
new bool | IsWidgetType () |
| |
new void | KillTimer (int id) |
| |
new object | Property (string name) |
| |
new void | RemoveEventFilter (QObject arg1) |
| |
new bool | SetProperty (string name, object value) |
| |
new void | SetUserData (uint id, QObjectUserData data) |
new bool | SignalsBlocked () |
| |
new int | StartTimer (int interval) |
| |
new QObjectUserData | UserData (uint id) |
new void | Dispose () |
Public Member Functions inherited from QtCore.Qt | |
delegate QTextStream | FuncQTextStreamQTextStream (QTextStream qTextStream) |
delegate string | FuncStringQByteArray (QByteArray qByteArray) |
delegate QByteArray | FuncQByteArrayString (string @string) |
delegate void | ActionQtMsgTypeString (QtMsgType qtMsgType, string @string) |
delegate QObject | FuncQObject () |
Static Public Member Functions | |
static string | Tr (string s, string c=null) |
static string | Tr (string s, string c, int n) |
static string | TrUtf8 (string s, string c=null) |
static string | TrUtf8 (string s, string c, int n) |
Static Public Member Functions inherited from QtCore.QObject | |
static bool | Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection) |
| |
static bool | Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection) |
| |
static bool | Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member) |
| |
static bool | Disconnect (QObject sender, string signal, QObject receiver, string member) |
| |
static uint | RegisterUserData () |
static string | Tr (string s, string c=null) |
| |
static string | Tr (string s, string c, int n) |
| |
static string | TrUtf8 (string s, string c=null) |
| |
static string | TrUtf8 (string s, string c, int n) |
| |
Static Public Member Functions inherited from QtCore.Qt | |
static QDataStream | Write (QDataStream s, object p) |
static QDataStream | Write (QDataStream arg1, QSizeF arg2) |
static QTextStream | Write (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Write (QDataStream arg1, QPoint arg2) |
static QDataStream | Write (QDataStream arg1, QLineF arg2) |
static QDataStream | Write (QDataStream arg1, QPointF arg2) |
static QDataStream | Write (QDataStream arg1, QChar arg2) |
static QDataStream | Write (QDataStream arg1, QByteArray arg2) |
static QDataStream | Write (QDataStream arg1, QEasingCurve arg2) |
static QDataStream | Write (QDataStream arg1, QRectF arg2) |
static QDataStream | Write (QDataStream arg1, QDateTime arg2) |
static QDataStream | Write (QDataStream arg1, QUrl arg2) |
static QDataStream | Write (QDataStream arg1, QTime arg2) |
static QDataStream | Write (QDataStream arg1, QLocale arg2) |
static QDataStream | Write (QDataStream arg1, QBitArray arg2) |
static QDataStream | Write (QDataStream arg1, QUuid arg2) |
static QDataStream | Write (QDataStream arg1, QLine arg2) |
static QDataStream | Write (QDataStream arg1, QDate arg2) |
static QDataStream | Write (QDataStream @out, QRegExp regExp) |
static QDataStream | Write (QDataStream arg1, QRect arg2) |
static QDataStream | Write (QDataStream arg1, QSize arg2) |
static QDataStream | Write (QDataStream s, QVariant.Type p) |
static QDataStream | Write (QDataStream arg1, string arg2) |
static QDataStream | Write (QDataStream @out, System.Collections.Generic.List< string > list) |
static QDataStream | Read (QDataStream arg1, QChar arg2) |
static QDataStream | Read (QDataStream arg1, QLocale arg2) |
static QDataStream | Read (QDataStream arg1, QRect arg2) |
static QDataStream | Read (QDataStream arg1, QEasingCurve arg2) |
static QDataStream | Read (QDataStream arg1, QDate arg2) |
static QDataStream | Read (QDataStream arg1, QUrl arg2) |
static QDataStream | Read (QDataStream arg1, QUuid arg2) |
static QTextStream | Read (QTextStream s, Qt.FuncQTextStreamQTextStream f) |
static QDataStream | Read (QDataStream arg1, QLineF arg2) |
static QDataStream | Read (QDataStream arg1, QRectF arg2) |
static QDataStream | Read (QDataStream arg1, QPointF arg2) |
static QDataStream | Read (QDataStream arg1, QLine arg2) |
static QDataStream | Read (QDataStream arg1, QBitArray arg2) |
static QDataStream | Read (QDataStream arg1, QSize arg2) |
static QDataStream | Read (QDataStream arg1, QDateTime arg2) |
static QDataStream | Read (QDataStream arg1, QTime arg2) |
static QDataStream | Read (QDataStream arg1, QPoint arg2) |
static QDataStream | Read (QDataStream @in, QRegExp regExp) |
static QDataStream | Read (QDataStream s, object p) |
static QDataStream | Read (QDataStream arg1, QByteArray arg2) |
static QDataStream | Read (QDataStream arg1, QSizeF arg2) |
static QDataStream | Read (QDataStream arg1, string arg2) |
static QDataStream | Read (QDataStream s, QVariant.Type p) |
static QDataStream | Read (QDataStream @in, System.Collections.Generic.List< string > list) |
static double | qAcos (double v) |
static void | qAddPostRoutine (System.Action arg1) |
static string | qAppName () |
static double | qAsin (double v) |
static double | qAtan (double v) |
static double | qAtan2 (double x, double y) |
static void | qBadAlloc () |
static int | qCeil (double v) |
static ushort | qChecksum (string s, uint len) |
static QByteArray | qCompress (QByteArray data) |
static QByteArray | qCompress (QByteArray data, int compressionLevel=-1) |
static QByteArray | qCompress (Pointer< byte > data, int nbytes) |
static QByteArray | qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1) |
static double | qCos (double v) |
static double | qExp (double v) |
static double | qFabs (double v) |
static double | qFastCos (double x) |
static double | qFastSin (double x) |
static string | qFlagLocation (string method) |
static int | qFloor (double v) |
static bool | qFuzzyCompare (double p1, double p2) |
static bool | qFuzzyCompare (float p1, float p2) |
static bool | qFuzzyIsNull (double d) |
static bool | qFuzzyIsNull (float f) |
static uint | qHash (QBitArray key) |
static uint | qHash (QChar key) |
static uint | qHash (QStringRef key) |
static uint | qHash (QUrl url) |
static uint | qHash (QPersistentModelIndex index) |
static uint | qHash (QByteArray key) |
static uint | qHash (QModelIndex index) |
static uint | qHash (uint key) |
static uint | qHash (sbyte key) |
static uint | qHash (byte key) |
static uint | qHash (short key) |
static uint | qHash (NativeLong key) |
static uint | qHash (ushort key) |
static uint | qHash (long key) |
static uint | qHash (ulong key) |
static uint | qHash (int key) |
static uint | qHash (string key) |
static uint | qHash (NativeULong key) |
static double | qInf () |
static Qt.ActionQtMsgTypeString | qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1) |
static int | qIntCast (float f) |
static int | qIntCast (double f) |
static bool | qIsFinite (double d) |
static bool | qIsFinite (float f) |
static bool | qIsInf (float f) |
static bool | qIsInf (double d) |
static bool | qIsNaN (float f) |
static bool | qIsNaN (double d) |
static bool | qIsNull (float f) |
static bool | qIsNull (double d) |
static double | qLn (double v) |
static double | qPow (double x, double y) |
static double | qQNaN () |
static void | qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function) |
static void | qRemovePostRoutine (System.Action arg1) |
static int | qRound (double d) |
static long | qRound64 (double d) |
static double | qSNaN () |
static bool | qSharedBuild () |
static double | qSin (double v) |
static double | qSqrt (double v) |
static bool | qStringComparisonHelper (QStringRef s1, string s2) |
static double | qTan (double v) |
static QByteArray | qUncompress (QByteArray data) |
static QByteArray | qUncompress (Pointer< byte > data, int nbytes) |
static string | qVersion () |
static void | Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size) |
static QByteArray | Qgetenv (string varName) |
static bool | Qputenv (string varName, QByteArray value) |
static int | Qrand () |
static void | Qsrand (uint seed) |
static int | Qstrcmp (QByteArray str1, QByteArray str2) |
static int | Qstrcmp (QByteArray str1, string str2) |
static int | Qstrcmp (string str1, QByteArray str2) |
static int | Qstrcmp (string str1, string str2) |
static Pointer< sbyte > | Qstrcpy (Pointer< sbyte > dst, string src) |
static Pointer< sbyte > | Qstrdup (string arg1) |
static int | Qstricmp (string arg1, string arg2) |
static uint | Qstrlen (string str) |
static int | Qstrncmp (string str1, string str2, uint len) |
static Pointer< sbyte > | Qstrncpy (Pointer< sbyte > dst, string src, uint len) |
static int | Qstrnicmp (string arg1, string arg2, uint len) |
static uint | Qstrnlen (string str, uint maxlen) |
static string | QtTrId (string id, int n=-1) |
Protected Member Functions | |
QTimeLine (System.Type dummy) | |
new void | OnFinished () |
| |
new void | OnFrameChanged (int arg1) |
| |
new void | OnStateChanged (QTimeLine.State newState) |
| |
override void | OnTimerEvent (QTimerEvent @event) |
| |
new void | OnValueChanged (double x) |
| |
Protected Member Functions inherited from QtCore.QObject | |
QObject (System.Type dummy) | |
virtual void | OnChildEvent (QChildEvent arg1) |
| |
virtual void | ConnectNotify (string signal) |
| |
virtual void | OnCustomEvent (QEvent arg1) |
| |
new void | OnDestroyed (QObject arg1=null) |
| |
virtual void | DisconnectNotify (string signal) |
| |
new int | Receivers (string signal) |
| |
new QObject | Sender () |
| |
new int | SenderSignalIndex () |
| |
virtual void | OnTimerEvent (QTimerEvent arg1) |
| |
Properties | |
Slot< System.Double > | ValueChanged |
| |
Slot< System.Int32 > | FrameChanged |
| |
Slot< QTimeLine.State > | StateChanged |
| |
Slot | Finished |
| |
new int | EndFrame [get, set] |
| |
new int | StartFrame [get, set] |
| |
new int | Duration [get, set] |
| |
new int | UpdateInterval [get, set] |
| |
new int | CurrentTime [get, set] |
| |
new Direction | direction [get, set] |
| |
new int | LoopCount [get, set] |
| |
new CurveShape | curveShape [get, set] |
| |
new QEasingCurve | EasingCurve [get, set] |
static new QMetaObject | StaticMetaObject [get] |
new IQTimeLineSignals | Emit [get] |
Properties inherited from QtCore.QObject | |
virtual EventHandler < QEventArgs< QChildEvent > > | ChildEvent |
| |
virtual EventHandler < QEventArgs< QEvent > > | CustomEvent |
| |
virtual EventHandler < QEventArgs< QEvent > > | Event |
| |
virtual EventHandler < QEventArgs< QTimerEvent > > | TimerEvent |
| |
Slot< QObject > | DestroyedQObject |
Slot | Destroyed |
| |
new QObject | Parent [get, set] |
| |
virtual System.IntPtr | SmokeObject [get, set] |
new string | ObjectName [get, set] |
| |
static new QMetaObject | StaticMetaObject [get] |
| |
static new QMetaObject | StaticQtMetaObject [get] |
new IQObjectSignals | Emit [get] |
Additional Inherited Members | |
Protected Attributes inherited from QtCore.QObject | |
object | Q_EMIT = null |
SmokeInvocation | interceptor |
readonly List< QEventHandler > | eventFilters = new List<QEventHandler>() |
The QTimeLine class provides a timeline for controlling animations.
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 (e.g., 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, SIGNAL(frameChanged(int)), progressBar, SLOT(setValue(int)));
// Clicking the push button will start the progress bar animation
pushButton = new QPushButton(tr("Start animation"), this);
connect(pushButton, SIGNAL(clicked()), timeLine, SLOT(start()));
...
You can also use QTimeLine with the Graphics View framework for animations. The QGraphicsItemAnimation class implements animation of QGraphicsItems with a timeline.
By default the timeline runs once, from the beginning and towards the 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 setCurveShape().
Note that by default, QTimeLine uses the EaseInOut curve shape, 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 curveShape property is ignored.
See also QProgressBar, QProgressDialog, and QGraphicsItemAnimation.
This enum describes the default shape of QTimeLine's value curve. The default, shape is EaseInOutCurve. The curve defines the relation between the value and the timeline.
See also setCurveShape().
This enum describes the direction of the timeline when in Running state.
See also setDirection().
This enum describes the state of the timeline.
See also state() and stateChanged().
NotRunning |
The timeline is not running. This is the initial state of QTimeLine, and the state QTimeLine reenters when finished. The current time, frame and value remain unchanged until either setCurrentTime() is called, or the timeline is started by calling start(). |
Paused |
The timeline is paused (i.e., temporarily suspended). Calling setPaused(false) will resume timeline activity. |
Running |
The timeline is running. While control is in the event loop, QTimeLine will update its current time at regular intervals, emitting valueChanged() and frameChanged() when appropriate. |
|
protected |
QtCore.QTimeLine.QTimeLine | ( | int | duration = 1000 , |
QObject | parent = null |
||
) |
Constructs a timeline with a duration of duration milliseconds. parent is passed to QObject's constructor. The default duration is 1000 milliseconds.
|
virtual |
Reimplemented from QtCore.QObject.
new int QtCore.QTimeLine.CurrentFrame | ( | ) |
Returns the frame corresponding to the current time.
See also currentTime(), frameForTime(), and setFrameRange().
new double QtCore.QTimeLine.CurrentValue | ( | ) |
Returns the value corresponding to the current time.
See also valueForTime() and currentFrame().
new void QtCore.QTimeLine.Dispose | ( | ) |
new int QtCore.QTimeLine.FrameForTime | ( | int | msec | ) |
Returns the frame corresponding to the time msec. This value is calculated using a linear interpolation of the start and end frame, based on the value returned by valueForTime().
See also valueForTime() and setFrameRange().
|
protected |
This signal is emitted when QTimeLine finishes (i.e., reaches the end of its time line), and does not loop.
|
protected |
QTimeLine emits this signal at regular intervals when in Running state, but only if the current frame changes. frame is the current frame number.
See also QTimeLine::setFrameRange() and QTimeLine::updateInterval.
|
protected |
This signal is emitted whenever QTimeLine's state changes. The new state is newState.
|
protected |
Reimplemented from QObject::timerEvent().
|
protected |
QTimeLine emits this signal at regular intervals when in Running state, but only if the current value changes. value is the current value. value is a number between 0.0 and 1.0
See also QTimeLine::setDuration(), QTimeLine::valueForTime(), and QTimeLine::updateInterval.
new void QtCore.QTimeLine.Resume | ( | ) |
Resumes the timeline from the current time. QTimeLine will reenter Running state, and once it enters the event loop, it will update its current time, frame and value at regular intervals.
In contrast to start(), this function does not restart the timeline before it resumes.
See also start(), updateInterval(), frameChanged(), and valueChanged().
new void QtCore.QTimeLine.SetFrameRange | ( | int | startFrame, |
int | endFrame | ||
) |
Sets the timeline's frame counter to start at startFrame, and end and endFrame. For each time value, QTimeLine will find the corresponding frame when you call currentFrame() or frameForTime() by interpolating, using the return value of valueForTime().
When in Running state, QTimeLine also emits the frameChanged() signal when the frame changes.
See also startFrame(), endFrame(), start(), and currentFrame().
new void QtCore.QTimeLine.SetPaused | ( | bool | paused | ) |
new void QtCore.QTimeLine.Start | ( | ) |
Starts the timeline. QTimeLine will enter Running state, and once it enters the event loop, it will update its current time, frame and value at regular intervals. The default interval is 40 ms (i.e., 25 times per second). You can change the update interval by calling setUpdateInterval().
The timeline will start from position 0, or the end if going backward. If you want to resume a stopped timeline without restarting, you can call resume() instead.
See also resume(), updateInterval(), frameChanged(), and valueChanged().
new QTimeLine.State QtCore.QTimeLine.state | ( | ) |
Returns the state of the timeline.
See also start(), setPaused(), and stop().
new void QtCore.QTimeLine.Stop | ( | ) |
Stops the timeline, causing QTimeLine to enter NotRunning state.
See also start().
new void QtCore.QTimeLine.ToggleDirection | ( | ) |
Toggles the direction of the timeline. If the direction was Forward, it becomes Backward, and vice verca.
See also setDirection().
|
static |
|
static |
|
static |
|
static |
|
virtual |
Returns the timeline value for the time msec. The returned value, which varies depending on the curve shape, is always between 0 and 1. If msec is 0, the default implementation always returns 0.
Reimplement this function to provide a custom curve shape for your timeline.
See also CurveShape and frameForTime().
|
getset |
This property holds the current time of the time line.
When QTimeLine is in Running state, this value is updated continuously as a function of the duration and direction of the timeline. Otherwise, it is value that was current when stop() was called last, or the value set by setCurrentTime().
By default, this property contains a value of 0.
|
getset |
This property holds the shape of the timeline curve.
The curve shape describes the relation between the time and value for the base implementation of valueForTime().
If you have reimplemented valueForTime(), this value is ignored.
By default, this property is set to EaseInOutCurve.
|
getset |
This property holds the direction of the timeline when QTimeLine is in Running state.
This direction indicates whether the time moves from 0 towards the timeline duration, or from the value of the duration and towards 0 after start() has been called.
By default, this property is set to Forward.
|
getset |
This property holds the total duration of the timeline in milliseconds.
By default, this value is 1000 (i.e., 1 second), but you can change this by either passing a duration to QTimeLine's constructor, or by calling setDuration(). The duration must be larger than 0.
Note: Changing the duration does not cause the current time to be reset to zero or the new duration. You also need to call setCurrentTime() with the desired value.
|
getset |
|
getprotected |
|
getset |
Returns 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).
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.
|
addremove |
This signal is emitted when QTimeLine finishes (i.e., reaches the end of its time line), and does not loop.
|
addremove |
QTimeLine emits this signal at regular intervals when in Running state, but only if the current frame changes. frame is the current frame number.
See also QTimeLine::setFrameRange() and QTimeLine::updateInterval.
|
getset |
This property holds the number of times the timeline should loop before it's finished.
A loop count of of 0 means that the timeline will loop forever.
By default, this property contains a value of 1.
|
getset |
Returns 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).
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.
|
addremove |
This signal is emitted whenever QTimeLine's state changes. The new state is newState.
|
staticget |
|
getset |
This property holds the time in milliseconds between each time QTimeLine updates its current time.
When updating the current time, QTimeLine will emit valueChanged() if the current value changed, and frameChanged() if the frame changed.
By default, the interval is 40 ms, which corresponds to a rate of 25 updates per second.
|
addremove |
QTimeLine emits this signal at regular intervals when in Running state, but only if the current value changes. value is the current value. value is a number between 0.0 and 1.0
See also QTimeLine::setDuration(), QTimeLine::valueForTime(), and QTimeLine::updateInterval.