QGraphicsPathItem Class

QGraphicsPathItem クラスは、QGraphicsScene に追加できるパス・アイテムを提供します

ヘッダー #include <QGraphicsPathItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
継承: QAbstractGraphicsShapeItem

パブリックな型

enum anonymous { Type }

パブリック関数

QGraphicsPathItem(QGraphicsItem *parent = nullptr)
QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
virtual ~QGraphicsPathItem()
QPainterPath path() const
void setPath(const QPainterPath &path)

再実装されたパブリック関数

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 = nullptr) override
virtual QPainterPath shape() const override
virtual int type() const override

詳細説明

アイテムのパスを設定するには、QPainterPath を QGraphicsPathItem のコンストラクタに渡すか、setPath() 関数を呼び出します。path() 関数は現在のパスを返します。

QGraphicsPathItem は、このパスを使用して、boundingRect()、shape()、contains() の妥当な実装を提供します。paint() 関数は、アイテムに関連付けられたペンとブラシを使用してパスを描画します。このペンとブラシは、setPen() 関数とsetBrush() 関数を呼び出すことで設定できます。

QGraphicsRectItem,QGraphicsEllipseItem,QGraphicsPolygonItem,QGraphicsTextItem,QGraphicsLineItem,QGraphicsPixmapItem, およびGraphics View Frameworkも参照

メンバ型ドキュメント

enum QGraphicsPathItem::anonymous

仮想type() 関数が返す値。

定数説明
QGraphicsPathItem::Type2グラフィックパス項目

メンバ関数ドキュメント

[explicit] QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent = nullptr)

QGraphicsPath を構築します。parentQAbstractGraphicsShapeItem のコンストラクタに渡されます。

QGraphicsScene::addItem()も参照してください

[explicit] QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)

path をデフォルトパスとして QGraphicsPath アイテムを構築します。parentQAbstractGraphicsShapeItem のコンストラクタに渡されます。

QGraphicsScene::addItem()も参照してください

[virtual noexcept] QGraphicsPathItem::~QGraphicsPathItem()

QGraphicsPathItem を破壊する。

[override virtual] QRectF QGraphicsPathItem::boundingRect() const

再実装:QGraphicsItem::boundingRect() const.

[override virtual] bool QGraphicsPathItem::contains(const QPointF &point) const

再実装:QGraphicsItem::contains(const QPointF &point) const.

[override virtual] bool QGraphicsPathItem::isObscuredBy(const QGraphicsItem *item) const

再実装:QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const.

[override virtual] QPainterPath QGraphicsPathItem::opaqueArea() const

再実装:QAbstractGraphicsShapeItem::opaqueArea() const.

[override virtual] void QGraphicsPathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)

再実装:QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)。

QPainterPath QGraphicsPathItem::path() const

アイテムのパスをQPainterPath として返します。 アイテムが設定されていない場合は、空のQPainterPath が返されます。

setPath()も参照

void QGraphicsPathItem::setPath(const QPainterPath &path)

アイテムのパスを指定されたpath に設定します。

path()も参照

[override virtual] QPainterPath QGraphicsPathItem::shape() const

再実装:QGraphicsItem::shape() const.

[override virtual] int QGraphicsPathItem::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.