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은 픽스맵의 선택적 알파 마스크를 사용하여 boundingRect(), shape() 및 contains()을 합리적으로 구현합니다.

픽스맵은 offset() 함수가 반환하는 항목의 (0, 0) 좌표에 그려집니다. setOffset() 함수를 호출하여 그리기 오프셋을 변경할 수 있습니다.
setTransformationMode()를 호출하여 픽스맵의 변환 모드를 설정할 수 있습니다. 기본적으로 Qt::FastTransformation 가 사용되며, 이는 빠르지만 부드럽지 않은 스케일링을 제공합니다. Qt::SmoothTransformation 는 페인터에서 QPainter::SmoothPixmapTransform 를 활성화하며, 품질은 플랫폼과 뷰포트에 따라 달라집니다. 일반적으로 이 경우의 결과는 QPixmap::scale()을 직접 호출했을 때만큼 좋지 않습니다. transformationMode()를 호출하여 항목의 현재 변환 모드를 확인하십시오.
QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsLineItem 및 Graphics View Framework도참조하십시오 .
멤버 유형 문서
enum QGraphicsPixmapItem::ShapeMode
이 열거형은 ‘ QGraphicsPixmapItem ’이 모양과 불투명 영역을 계산하는 방식을 설명합니다.
기본값은 MaskShape입니다.
| 상수 | 값 | 설명 |
|---|---|---|
QGraphicsPixmapItem::MaskShape | 0 | 모양은 QPixmap::mask()를 호출하여 결정됩니다. 이 모양에는 픽스맵의 불투명한 픽셀만 포함됩니다. 그러나 모양이 더 복잡하기 때문에 다른 모드보다 속도가 느릴 수 있으며, 더 많은 메모리를 사용합니다. |
QGraphicsPixmapItem::BoundingRectShape | 1 | 이 모양은 픽스맵의 윤곽을 추적하여 결정됩니다. 이 모드는 가장 빠른 모양 모드이지만, 픽스맵의 투명한 영역은 고려하지 않습니다. |
QGraphicsPixmapItem::HeuristicMaskShape | 2 | QPixmap::createHeuristicMask() 함수를 호출하여 도형을 결정합니다. 성능과 메모리 사용량은 MaskShape와 비슷합니다. |
[anonymous] enum
가상 함수 ` type()`가 반환하는 값.
| 상수 | 값 | 설명 |
|---|---|---|
QGraphicsPixmapItem::Type | 7 | 그래픽 픽스맵 항목 |
멤버 함수 설명서
[explicit] QGraphicsPixmapItem::QGraphicsPixmapItem(QGraphicsItem *parent = nullptr)
QGraphicsPixmapItem을 생성합니다. ` parent `는 ` QGraphicsItem`의 생성자에 전달됩니다.
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 *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)를 재구현합니다.
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를 재구현합니다.
© 2026 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.