PythonQt.QtGui.QGraphicsItemAnimation
QGraphicsItemAnimation
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
The QGraphicsItemAnimation class animates a
QGraphicsItem. You can schedule
changes to the item's transformation matrix at specified steps. The
QGraphicsItemAnimation class has a current step value. When this value changes the
transformations scheduled at that step are performed. The current step of the animation
is set with the setStep() function.
QGraphicsItemAnimation will do a simple linear interpolation between the nearest adjacent scheduled changes to calculate the matrix. For instance, if you set the position of an item at values 0.0 and 1.0, the animation will show the item moving in a straight line between these positions. The same is true for scaling and rotation.
It is usual to use the class with a
QTimeLine. The timeline's
valueChanged() signal
is then connected to the setStep() slot. For example, you can set up an item for
rotation by calling setRotationAt() for different step values. The animations timeline
is set with the
setTimeLine()
function.
An example animation with a timeline follows:
QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
QTimeLine *timer = new QTimeLine(5000);
timer->setFrameRange(0, 100);
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(ball);
animation->setTimeLine(timer);
for (int i = 0; i < 200; ++i)
animation->setPosAt(i / 200.0, QPointF(i, i));
QGraphicsScene *scene = new QGraphicsScene;
scene->setSceneRect(0, 0, 250, 250);
scene->addItem(ball);
QGraphicsView *view = new QGraphicsView(scene);
view->show();
timer->start();
Note that steps lie between 0.0 and 1.0. It may be necessary to use setUpdateInterval(). The default update interval is 40 ms. A scheduled transformation cannot be removed when set, so scheduling several transformations of the same kind (e.g., rotations) at the same step is not recommended.
Source: https://doc.qt.io/archives/qt-5.15/qgraphicsitemanimation.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 |
|---|---|---|---|
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
afterAnimationStep |
function | (self, step: float) -> None |
This method is meant to be overridden in subclasses that need to execute additional code after a new step has taken place. |
beforeAnimationStep |
function | (self, step: float) -> None |
This method is meant to be overridden by subclassed that needs to execute additional code before a new step takes place. |
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) |
clear |
function | (self) -> None |
Clears the scheduled transformations used for the animation, but retains the item and timeline. |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
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.QtGui.QGraphicsItemAnimation.destroyed; argument details are not documented. |
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) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
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) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
horizontalScaleAt |
function | (self, step: float) -> float |
X.horizontalScaleAt(step) -> float |
horizontalShearAt |
function | (self, step: float) -> float |
X.horizontalShearAt(step) -> float |
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) |
item |
function | (self) -> Any |
X.item() -> PythonQt.QtGui.QGraphicsItem |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
matrixAt |
function | (self, step: float) -> Any |
X.matrixAt(step) -> PythonQt.QtGui.QMatrix |
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.QtGui.QGraphicsItemAnimation.objectNameChanged; argument details are not documented. |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
posAt |
function | (self, step: float) -> Any |
X.posAt(step) -> PythonQt.QtCore.QPointF |
posList |
function | (self) -> tuple |
X.posList() -> tuple |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
reset |
function | (self) -> None |
|
rotationAt |
function | (self, step: float) -> float |
X.rotationAt(step) -> float |
rotationList |
function | (self) -> tuple |
X.rotationList() -> tuple |
scaleList |
function | (self) -> tuple |
X.scaleList() -> tuple |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setItem |
function | (self, item: Any) -> None |
Sets the specified item to be used in the animation. |
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setPosAt |
function | (self, step: float, pos: Any) -> None |
X.setPosAt(step, pos) |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setRotationAt |
function | (self, step: float, angle: float) -> None |
X.setRotationAt(step, angle) |
setScaleAt |
function | (self, step: float, sx: float, sy: float) -> None |
X.setScaleAt(step, sx, sy) |
setShearAt |
function | (self, step: float, sh: float, sv: float) -> None |
X.setShearAt(step, sh, sv) |
setStep |
function | (self, x: float) -> None |
Sets the current step value for the animation, causing the transformations scheduled at this step to be performed. |
setTimeLine |
function | (self, timeLine: Any) -> None |
Sets the timeline object used to control the rate of animation to the timeLine specified. |
setTranslationAt |
function | (self, step: float, dx: float, dy: float) -> None |
X.setTranslationAt(step, dx, dy) |
shearList |
function | (self) -> tuple |
X.shearList() -> tuple |
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
thread |
function | (self) -> Any |
(shared captured text) |
timeLine |
function | (self) -> Any |
X.timeLine() -> PythonQt.QtCore.QTimeLine |
timerEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |
translationList |
function | (self) -> tuple |
X.translationList() -> tuple |
verticalScaleAt |
function | (self, step: float) -> float |
X.verticalScaleAt(step) -> float |
verticalShearAt |
function | (self, step: float) -> float |
X.verticalShearAt(step) -> float |
xTranslationAt |
function | (self, step: float) -> float |
X.xTranslationAt(step) -> float |
yTranslationAt |
function | (self, step: float) -> float |
X.yTranslationAt(step) -> float |