このページでは

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 { 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。

メンバ型のドキュメント

[anonymous] enum

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

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

メンバ関数のドキュメント

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

QGraphicsPath を生成します。parent は、QAbstractGraphicsShapeItem のコンストラクタに渡されます。

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

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

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

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 を再実装します。

© 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.