QGraphicsTransform Class
QGraphicsTransform 클래스는 QGraphicsItems에서 고급 변환을 구축하기 위한 추상 베이스 클래스입니다. 더 보기...
Header: | #include <QGraphicsTransform> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QObject |
상속 대상 |
공용 함수
QGraphicsTransform(QObject *parent = nullptr) | |
virtual | ~QGraphicsTransform() |
virtual void | applyTo(QMatrix4x4 *matrix) const = 0 |
보호된 슬롯
void | update() |
상세 설명
QGraphicsItem::transform 의 대안으로 QGraphicsTransform 을 사용하면 특수 프로퍼티를 사용하여 독립적으로 구성할 수 있는 고급 변환을 만들고 제어할 수 있습니다.
QGraphicsItem 를 사용하면 하나의 QGraphicsItem 에 원하는 수의 QGraphicsTransform 인스턴스를 할당할 수 있습니다. 각 QGraphicsTransform은 할당된 QGraphicsItem 에 한 번에 하나씩 순서대로 적용됩니다.
QGraphicsTransform은 애니메이션에 특히 유용합니다. QGraphicsItem::setTransform ()를 사용하면 항목에 직접 트랜스폼을 할당할 수 있지만, 두 개의 다른 트랜스폼 사이를 보간하는 직접적인 방법은 없습니다(예: 항목에 각각 다른 임의의 트랜스폼이 할당된 두 상태 사이를 전환할 때). QGraphicsTransform을 사용하면 각 독립 트랜스폼의 프로퍼티 값을 보간할 수 있습니다. 그런 다음 결과 연산이 단일 변환으로 결합되어 QGraphicsItem 에 적용됩니다.
변환은 QMatrix4x4 을 사용하여 실제 3D 공간에서 계산됩니다. 변환이 QGraphicsItem 에 적용되면 2D QTransform 에 다시 투영됩니다. QGraphicsItem 에 여러 개의 QGraphicsTransform 개체를 적용하면 모든 변환이 실제 3D 공간에서 계산되며, 2D로 다시 투영되는 것은 마지막 QGraphicsTransform이 적용된 후에만 발생합니다. 예외적으로 QGraphicsRotation 은 각 회전 후 2D로 다시 투영하여 X축과 Y축의 원근 효과를 유지합니다.
자신만의 구성 가능한 변환을 만들려면 QGraphicsTransform의 서브클래스(또는 기존 서브클래스)를 만들고 QMatrix4x4 에 대한 포인터를 받는 순수 가상 applyTo() 함수를 다시 구현하면 됩니다. 적용하려는 각 연산은 프로퍼티로 노출되어야 합니다(예: customTransform->setVerticalShear(2.5)). applyTo ()의 재구현 내에서 제공된 트랜스폼을 각각 수정할 수 있습니다.
QGraphicsTransform은 QGraphicsItem::setTransform(), QGraphicsItem::setRotation(), QGraphicsItem::setScale()와 함께 사용할 수 있습니다.
QGraphicsItem::transform(), QGraphicsScale, QGraphicsRotation 를참조하세요 .
멤버 함수 문서
QGraphicsTransform::QGraphicsTransform(QObject *parent = nullptr)
주어진 parent 로 새로운 QGraphicsTransform 을 구축합니다.
[virtual noexcept]
QGraphicsTransform::~QGraphicsTransform()
그래픽 트랜스폼을 파괴합니다.
[pure virtual]
void QGraphicsTransform::applyTo(QMatrix4x4 *matrix) const
이 순수한 가상 메서드는 파생 클래스에서 다시 구현해야 합니다.
이 변환을 matrix 에 적용합니다.
QGraphicsItem::transform() 및 QMatrix4x4::toTransform()도 참조하세요 .
[protected slot]
void QGraphicsTransform::update()
applyTo()가 이전과 다른 결과를 반환하도록 이 트랜스폼 작업이 매개변수를 변경했음을 알립니다.
사용자 지정 그래픽 트랜스폼을 구현할 때는 매개 변수를 변경할 때마다 이 함수를 호출하여 QGraphicsItem 에 트랜스폼을 업데이트해야 함을 알려야 합니다.
applyTo()도 참조하세요 .
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.