[][src]Struct qt_widgets::QGraphicsTransform

#[repr(C)]pub struct QGraphicsTransform { /* fields omitted */ }

The QGraphicsTransform class is an abstract base class for building advanced transformations on QGraphicsItems.

C++ class: QGraphicsTransform.

C++ documentation:

The QGraphicsTransform class is an abstract base class for building advanced transformations on QGraphicsItems.

As an alternative to QGraphicsItem::transform, QGraphicsTransform lets you create and control advanced transformations that can be configured independently using specialized properties.

QGraphicsItem allows you to assign any number of QGraphicsTransform instances to one QGraphicsItem. Each QGraphicsTransform is applied in order, one at a time, to the QGraphicsItem it's assigned to.

QGraphicsTransform is particularly useful for animations. Whereas QGraphicsItem::setTransform() lets you assign any transform directly to an item, there is no direct way to interpolate between two different transformations (e.g., when transitioning between two states, each for which the item has a different arbitrary transform assigned). Using QGraphicsTransform you can interpolate the property values of each independent transformation. The resulting operation is then combined into a single transform which is applied to QGraphicsItem.

Transformations are computed in true 3D space using QMatrix4x4. When the transformation is applied to a QGraphicsItem, it will be projected back to a 2D QTransform. When multiple QGraphicsTransform objects are applied to a QGraphicsItem, all of the transformations are computed in true 3D space, with the projection back to 2D only occurring after the last QGraphicsTransform is applied. The exception to this is QGraphicsRotation, which projects back to 2D after each rotation to preserve the perspective effect around the X and Y axes.

If you want to create your own configurable transformation, you can create a subclass of QGraphicsTransform (or any or the existing subclasses), and reimplement the pure virtual applyTo() function, which takes a pointer to a QMatrix4x4. Each operation you would like to apply should be exposed as properties (e.g., customTransform->setVerticalShear(2.5)). Inside you reimplementation of applyTo(), you can modify the provided transform respectively.

QGraphicsTransform can be used together with QGraphicsItem::setTransform(), QGraphicsItem::setRotation(), and QGraphicsItem::setScale().

Methods

impl QGraphicsTransform[src]

pub fn slot_update(&self) -> Receiver<()>[src]

Notifies that this transform operation has changed its parameters in such a way that applyTo() will return a different result than before.

Returns a built-in Qt slot QGraphicsTransform::update that can be passed to qt_core::Signal::connect.

C++ documentation:

Notifies that this transform operation has changed its parameters in such a way that applyTo() will return a different result than before.

When implementing you own custom graphics transform, you must call this function every time you change a parameter, to let QGraphicsItem know that its transformation needs to be updated.

See also applyTo().

pub unsafe fn apply_to(&self, matrix: impl CastInto<Ptr<QMatrix4X4>>)[src]

This pure virtual method has to be reimplemented in derived classes.

Calls C++ function: pure virtual void QGraphicsTransform::applyTo(QMatrix4x4* matrix) const.

C++ documentation:

This pure virtual method has to be reimplemented in derived classes.

It applies this transformation to matrix.

See also QGraphicsItem::transform() and QMatrix4x4::toTransform().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QGraphicsTransform::metaObject() const.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QGraphicsTransform::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QGraphicsTransform::qt_metacast(const char* arg1).

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QGraphicsTransform::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QGraphicsTransform::trUtf8(const char* s, const char* c, int n).

Trait Implementations

impl CppDeletable for QGraphicsTransform[src]

unsafe fn delete(&self)[src]

Destroys the graphics transform.

Calls C++ function: virtual [destructor] void QGraphicsTransform::~QGraphicsTransform().

C++ documentation:

Destroys the graphics transform.

impl Deref for QGraphicsTransform[src]

type Target = QObject

The resulting type after dereferencing.

fn deref(&self) -> &QObject[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsTransform* ptr).

impl DynamicCast<QGraphicsRotation> for QGraphicsTransform[src]

unsafe fn dynamic_cast(ptr: Ptr<QGraphicsTransform>) -> Ptr<QGraphicsRotation>[src]

Calls C++ function: QGraphicsRotation* dynamic_cast<QGraphicsRotation*>(QGraphicsTransform* ptr).

impl DynamicCast<QGraphicsScale> for QGraphicsTransform[src]

unsafe fn dynamic_cast(ptr: Ptr<QGraphicsTransform>) -> Ptr<QGraphicsScale>[src]

Calls C++ function: QGraphicsScale* dynamic_cast<QGraphicsScale*>(QGraphicsTransform* ptr).

impl DynamicCast<QGraphicsTransform> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QGraphicsTransform>[src]

Calls C++ function: QGraphicsTransform* dynamic_cast<QGraphicsTransform*>(QObject* ptr).

impl StaticDowncast<QGraphicsRotation> for QGraphicsTransform[src]

unsafe fn static_downcast(
    ptr: Ptr<QGraphicsTransform>
) -> Ptr<QGraphicsRotation>
[src]

Calls C++ function: QGraphicsRotation* static_cast<QGraphicsRotation*>(QGraphicsTransform* ptr).

impl StaticDowncast<QGraphicsScale> for QGraphicsTransform[src]

unsafe fn static_downcast(ptr: Ptr<QGraphicsTransform>) -> Ptr<QGraphicsScale>[src]

Calls C++ function: QGraphicsScale* static_cast<QGraphicsScale*>(QGraphicsTransform* ptr).

impl StaticDowncast<QGraphicsTransform> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QGraphicsTransform>[src]

Calls C++ function: QGraphicsTransform* static_cast<QGraphicsTransform*>(QObject* ptr).

impl StaticUpcast<QGraphicsTransform> for QGraphicsScale[src]

unsafe fn static_upcast(ptr: Ptr<QGraphicsScale>) -> Ptr<QGraphicsTransform>[src]

Calls C++ function: QGraphicsTransform* static_cast<QGraphicsTransform*>(QGraphicsScale* ptr).

impl StaticUpcast<QGraphicsTransform> for QGraphicsRotation[src]

unsafe fn static_upcast(ptr: Ptr<QGraphicsRotation>) -> Ptr<QGraphicsTransform>[src]

Calls C++ function: QGraphicsTransform* static_cast<QGraphicsTransform*>(QGraphicsRotation* ptr).

impl StaticUpcast<QObject> for QGraphicsTransform[src]

unsafe fn static_upcast(ptr: Ptr<QGraphicsTransform>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QGraphicsTransform* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.