QGraphicsPixmapItem Class
QGraphicsPixmapItem 클래스는 QGraphicsScene 에 추가할 수 있는 픽셀맵 항목을 제공합니다.. ..
헤더: | #include <QGraphicsPixmapItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
상속합니다: | QGraphicsItem |
공용 타입
공용 함수
QGraphicsPixmapItem(QGraphicsItem *parent = nullptr) | |
QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = nullptr) | |
virtual | ~QGraphicsPixmapItem() |
QPointF | offset() const |
QPixmap | pixmap() const |
void | setOffset(const QPointF &offset) |
void | setOffset(qreal x, qreal y) |
void | setPixmap(const QPixmap &pixmap) |
void | setShapeMode(QGraphicsPixmapItem::ShapeMode mode) |
void | setTransformationMode(Qt::TransformationMode mode) |
QGraphicsPixmapItem::ShapeMode | shapeMode() const |
Qt::TransformationMode | transformationMode() const |
재구현된 공용 함수
virtual QRectF | boundingRect() const override |
virtual bool | contains(const QPointF &point) const override |
virtual bool | isObscuredBy(const QGraphicsItem *item) const override |
virtual QPainterPath | opaqueArea() const override |
virtual void | paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override |
virtual QPainterPath | shape() const override |
virtual int | type() const override |
상세 설명
아이템의 픽스맵을 설정하려면, QGraphicsPixmapItem의 생성자에 QPixmap 을 전달하거나 setPixmap() 함수를 호출합니다. pixmap () 함수는 현재 픽스맵을 반환합니다.
QGraphicsPixmapItem은 pixmap의 선택적 알파 마스크를 사용하여 boundingRect(), shape() 및 contains()의 합리적인 구현을 제공합니다.
픽셀맵은 offset()에서 반환된 대로 항목의 (0, 0) 좌표에 그려집니다. setOffset ()를 호출하여 그리기 오프셋을 변경할 수 있습니다.
setTransformationMode()를 호출하여 픽셀맵의 변환 모드를 설정할 수 있습니다. 기본적으로 Qt::FastTransformation 이 사용되며, 이는 빠르고 부드럽지 않은 스케일링을 제공합니다. Qt::SmoothTransformation 은 페인터에서 QPainter::SmoothPixmapTransform 을 활성화하며, 품질은 플랫폼과 뷰포트에 따라 다릅니다. 결과는 일반적으로 QPixmap::scale()을 직접 호출하는 것보다 좋지 않습니다. transformationMode ()를 호출하여 항목의 현재 변환 모드를 가져옵니다.
QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsLineItem 및 그래픽 뷰 프레임워크도참조하세요 .
멤버 유형 문서
enum QGraphicsPixmapItem::ShapeMode
이 열거형은 QGraphicsPixmapItem 에서 모양과 불투명 영역을 계산하는 방법을 설명합니다.
기본값은 MaskShape입니다.
Constant | 값 | 설명 |
---|---|---|
QGraphicsPixmapItem::MaskShape | 0 | 모양은 QPixmap::mask()를 호출하여 결정됩니다. 이 모양에는 픽셀맵의 불투명 픽셀만 포함됩니다. 그러나 모양이 더 복잡하기 때문에 다른 모드보다 속도가 느려지고 메모리를 더 많이 사용할 수 있습니다. |
QGraphicsPixmapItem::BoundingRectShape | 1 | 도형은 픽셀맵의 윤곽선을 추적하여 결정됩니다. 가장 빠른 도형 모드이지만 픽셀맵의 투명 영역은 고려하지 않습니다. |
QGraphicsPixmapItem::HeuristicMaskShape | 2 | 모양은 QPixmap::createHeuristicMask()를 호출하여 결정됩니다. 성능과 메모리 소비량은 MaskShape와 비슷합니다. |
enum QGraphicsPixmapItem::anonymous
가상 type() 함수가 반환하는 값입니다.
상수 | Value | 설명 |
---|---|---|
QGraphicsPixmapItem::Type | 7 | 그래픽 픽스맵 항목 |
멤버 함수 문서
[explicit]
QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem *parent = nullptr)
QGraphicsItem 의 생성자에 parent 을 전달합니다.
QGraphicsScene::addItem()도 참조하십시오 .
[explicit]
QGraphicsPixmapItem::QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = nullptr)
pixmap 을 기본 픽스맵으로 사용하여 QGraphicsPixmapItem을 구축합니다. parent 은 QGraphicsItem 의 생성자에게 전달됩니다.
QGraphicsScene::addItem()도 참조하세요 .
[virtual noexcept]
QGraphicsPixmapItem::~QGraphicsPixmapItem()
QGraphicsPixmapItem 를 파괴합니다.
[override virtual]
QRectF QGraphicsPixmapItem::boundingRect() const
재구현합니다: QGraphicsItem::boundingRect() const.
[override virtual]
bool QGraphicsPixmapItem::contains(const QPointF &point) const
재구현합니다: QGraphicsItem::contains(const QPointF &point) const.
[override virtual]
bool QGraphicsPixmapItem::isObscuredBy(const QGraphicsItem *item) const
재구현합니다: QGraphicsItem::isObscuredBy(const QGraphicsItem *item) const.
QPointF QGraphicsPixmapItem::offset() const
픽셀맵의 왼쪽 상단 모서리 지점을 정의하는 픽셀맵 항목의 오프셋을 로컬 좌표로 반환합니다.
setOffset()도 참조하세요 .
[override virtual]
QPainterPath QGraphicsPixmapItem::opaqueArea() const
재구현합니다: QGraphicsItem::opaqueArea() const.
[override virtual]
void QGraphicsPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
재구현합니다: QGraphicsItem::paint(QPainter *페인터, const Q스타일옵션그래픽아이템 *옵션, Q위젯 *위젯).
QPixmap QGraphicsPixmapItem::pixmap() const
항목의 픽셀맵을 반환하거나 픽셀맵이 설정되지 않은 경우 잘못된 QPixmap 을 반환합니다.
setPixmap()도 참조하세요 .
void QGraphicsPixmapItem::setOffset(const QPointF &offset)
픽셀맵 항목의 오프셋을 offset 으로 설정합니다. QGraphicsPixmapItem 은 왼쪽 상단 모서리에 offset 을 사용하여 픽셀맵을 그립니다.
offset()도 참조하세요 .
void QGraphicsPixmapItem::setOffset(qreal x, qreal y)
이 편의 함수는 setOffset(QPointF(x, y))을 호출하는 것과 동일합니다.
void QGraphicsPixmapItem::setPixmap(const QPixmap &pixmap)
항목의 픽스맵을 pixmap 로 설정합니다.
pixmap()도 참조하세요 .
void QGraphicsPixmapItem::setShapeMode(QGraphicsPixmapItem::ShapeMode mode)
항목의 모양 모드를 mode 으로 설정합니다. 모양 모드는 QGraphicsPixmapItem 이 모양을 계산하는 방법을 설명합니다. 기본 모드는 MaskShape 입니다.
shapeMode() 및 ShapeMode도 참조하세요 .
void QGraphicsPixmapItem::setTransformationMode(Qt::TransformationMode mode)
픽셀맵 항목의 변환 모드를 mode 로 설정하고 항목의 업데이트를 토글합니다. 기본 모드는 스무딩 없이 빠른 변환을 제공하는 Qt::FastTransformation 입니다.
Qt::SmoothTransformation 는 페인터에서 QPainter::SmoothPixmapTransform 를 활성화하며, 품질은 플랫폼과 뷰포트에 따라 달라집니다. 결과는 일반적으로 QPixmap::scale()을 직접 호출하는 것만큼 좋지 않습니다.
transformationMode()도 참조하세요 .
[override virtual]
QPainterPath QGraphicsPixmapItem::shape() const
재구현합니다: QGraphicsItem::shape() const.
QGraphicsPixmapItem::ShapeMode QGraphicsPixmapItem::shapeMode() const
항목의 모양 모드를 반환합니다. 모양 모드는 QGraphicsPixmapItem 에서 모양을 계산하는 방법을 설명합니다. 기본 모드는 MaskShape 입니다.
setShapeMode() 및 ShapeMode도 참조하세요 .
Qt::TransformationMode QGraphicsPixmapItem::transformationMode() const
픽셀맵의 변환 모드를 반환합니다. 기본 모드는 Qt::FastTransformation 로, 스무딩 없이 빠른 변환을 제공합니다.
setTransformationMode()도 참조하세요 .
[override virtual]
int QGraphicsPixmapItem::type() const
재구현합니다: QGraphicsItem::type() const.
© 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.