In questa pagina

QGraphicsPathItem Class

La classe `QGraphicsPathItem` fornisce un elemento percorso che è possibile aggiungere a un ` QGraphicsScene`. Per saperne di più...

Intestazione: #include <QGraphicsPathItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
Eredita: QAbstractGraphicsShapeItem

Tipi pubblici

enum { Type }

Funzioni pubbliche

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

Funzioni pubbliche reimplementate

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

Descrizione dettagliata

Per impostare il percorso dell'elemento, passare un oggetto ` QPainterPath ` al costruttore di `QGraphicsPathItem` oppure chiamare la funzione ` setPath()`. La funzione ` path()` restituisce il percorso corrente.

Tratto tracciato in prossimità dell'origine

QGraphicsPathItem utilizza il percorso per fornire un'implementazione adeguata delle funzioni boundingRect(), shape() e contains(). La funzione paint() disegna il percorso utilizzando la penna e il pennello associati all'elemento, che è possibile impostare chiamando le funzioni setPen() e setBrush().

Vedi anche QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem e Graphics View Framework.

Documentazione sui tipi di membro

[anonymous] enum

Il valore restituito dalla funzione virtuale ` type()`.

CostanteValoreDescrizione
QGraphicsPathItem::Type2Un elemento del percorso grafico

Documentazione delle funzioni membro

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

Crea un oggetto QGraphicsPath. L'oggetto parent viene passato al costruttore di QAbstractGraphicsShapeItem.

Vedi anche QGraphicsScene::addItem().

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

Crea un oggetto QGraphicsPath utilizzando path come percorso predefinito. parent viene passato al costruttore di QAbstractGraphicsShapeItem.

Vedi anche QGraphicsScene::addItem().

[virtual noexcept] QGraphicsPathItem::~QGraphicsPathItem()

Distrugge l'QGraphicsPathItem.

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

Reimplementa: QGraphicsItem::boundingRect() const.

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

Reimplementa: QGraphicsItem::contains(const QPointF &point) const.

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

Reimplementa: QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const.

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

Reimplementa: QAbstractGraphicsShapeItem::opaqueArea() const.

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

Reimplementa: QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget).

QPainterPath QGraphicsPathItem::path() const

Restituisce il percorso dell'elemento come oggetto ` QPainterPath`. Se non è stato impostato alcun elemento, viene restituito un oggetto ` QPainterPath ` vuoto.

Vedi anche setPath().

void QGraphicsPathItem::setPath(const QPainterPath &path)

Imposta il percorso dell'elemento sul valore specificato path.

Vedi anche path().

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

Reimplementa: QGraphicsItem::shape() const.

[override virtual] int QGraphicsPathItem::type() const

Reimplementa: ` 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.