QGraphicsSimpleTextItem Class
QGraphicsSimpleTextItem 클래스는 QGraphicsScene 에 추가할 수 있는 간단한 텍스트 항목을 제공합니다. 더 보기...
| 헤더: | #include <QGraphicsSimpleTextItem> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| 상속: | QAbstractGraphicsShapeItem |
공개 유형
| enum { Type } |
공개 함수
| QGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr) | |
| QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsSimpleTextItem() |
| QFont | font() const |
| void | setFont(const QFont &font) |
| void | setText(const QString &text) |
| QString | text() 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 |
상세 설명
항목의 텍스트를 설정하려면 QGraphicsSimpleTextItem의 생성자에 ` QString `를 전달하거나, 나중에 ` setText()`를 호출하여 텍스트를 변경할 수 있습니다. 텍스트 채우기 색상을 설정하려면 ` setBrush()`를 호출하십시오.
단순 텍스트 항목은 채우기와 윤곽선을 모두 가질 수 있습니다. ` setBrush()`는 텍스트 채우기(즉, 텍스트 색상)를 설정하고, ` setPen()`는 텍스트 윤곽선을 그리는 데 사용될 펜을 설정합니다. (후자의 경우, 특히 복잡한 펜이나 텍스트 내용이 긴 항목에서는 속도가 느려질 수 있습니다.) 단순한 텍스트 한 줄만 그리려는 경우, setBrush()만 호출하고 펜은 설정하지 않은 상태로 두어야 합니다. QGraphicsSimpleTextItem의 펜은 기본적으로 Qt::NoPen 입니다.
QGraphicsSimpleTextItem은 텍스트의 서식 적용된 크기와 관련 글꼴을 사용하여 boundingRect(), shape(), contains() 함수를 적절하게 구현합니다. setFont()을 호출하여 글꼴을 설정할 수 있습니다.
QGraphicsSimpleText는 서식 있는 텍스트를 표시하지 않습니다. 대신, 완전한 텍스트 제어 기능을 제공하는 QGraphicsTextItem 를 사용할 수 있습니다.

QGraphicsTextItem, QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPixmapItem, QGraphicsPolygonItem, QGraphicsLineItem 및 Graphics View Framework도참조하십시오 .
멤버 유형 문서
[anonymous] enum
가상 함수 ` type()`가 반환하는 값.
| 상수 | 값 | 설명 |
|---|---|---|
QGraphicsSimpleTextItem::Type | 9 | 그래픽의 단순 텍스트 항목 |
멤버 함수 문서
[explicit] QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr)
QGraphicsSimpleTextItem 객체를 생성합니다.
parent QGraphicsItem 의 생성자에 전달됩니다.
QGraphicsScene::addItem()도 참조하십시오 .
[explicit] QGraphicsSimpleTextItem::QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = nullptr)
text 를 기본 일반 텍스트로 사용하여 QGraphicsSimpleTextItem을 생성합니다.
parent QGraphicsItem 의 생성자에 전달됩니다.
QGraphicsScene::addItem()도 참조하십시오 .
[virtual noexcept] QGraphicsSimpleTextItem::~QGraphicsSimpleTextItem()
QGraphicsSimpleTextItem 를 삭제합니다.
[override virtual] QRectF QGraphicsSimpleTextItem::boundingRect() const
QGraphicsItem::boundingRect() const를 재구현합니다.
[override virtual] bool QGraphicsSimpleTextItem::contains(const QPointF &point) const
QGraphicsItem::contains(const QPointF &point) const를 재구현합니다.
QFont QGraphicsSimpleTextItem::font() const
항목의 텍스트를 그리는 데 사용되는 글꼴을 반환합니다.
setFont()도 참조하십시오 .
[override virtual] bool QGraphicsSimpleTextItem::isObscuredBy(const QGraphicsItem *item) const
QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const를 재구현합니다.
[override virtual] QPainterPath QGraphicsSimpleTextItem::opaqueArea() const
QAbstractGraphicsShapeItem::opaqueArea() const를 재구현합니다.
[override virtual] void QGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)를 재구현합니다.
void QGraphicsSimpleTextItem::setFont(const QFont &font)
항목의 텍스트를 그릴 때 사용되는 글꼴을 ‘ font ’로 설정합니다.
font()도 참조하십시오 .
void QGraphicsSimpleTextItem::setText(const QString &text)
항목의 텍스트를 text 로 설정합니다. 텍스트는 일반 텍스트로 표시됩니다. 줄바꿈 문자('\n')와 QChar::LineSeparator 유형의 문자가 포함되면 항목이 텍스트를 여러 줄로 나누게 됩니다.
text()도 참조하십시오 .
[override virtual] QPainterPath QGraphicsSimpleTextItem::shape() const
QGraphicsItem::shape() const를 재구현합니다.
QString QGraphicsSimpleTextItem::text() const
항목의 텍스트를 반환합니다.
setText()도 참조하십시오 .
[override virtual] int QGraphicsSimpleTextItem::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.