QGraphicsPathItem Class
A classe `QGraphicsPathItem` fornece um item de caminho que você pode adicionar a um ` QGraphicsScene`. Mais...
| Cabeçalho: | #include <QGraphicsPathItem> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| Herdado de: | QAbstractGraphicsShapeItem |
Tipos públicos
| enum { Type } |
Funções públicas
| QGraphicsPathItem(QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsPathItem() |
| QPainterPath | path() const |
| void | setPath(const QPainterPath &path) |
Funções públicas reimplementadas
| 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 |
Descrição detalhada
Para definir o caminho do item, passe um ` QPainterPath ` ao construtor do `QGraphicsPathItem` ou chame a função ` setPath()`. A função ` path()` retorna o caminho atual.

O `QGraphicsPathItem` usa o caminho para fornecer uma implementação adequada das funções ` boundingRect()`, ` shape()` e ` contains()`. A função ` paint()` desenha o caminho usando a caneta e o pincel associados ao item, que você pode definir chamando as funções ` setPen()` e ` setBrush()`.
Veja também QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem e Graphics View Framework.
Documentação sobre tipos de membros
[anonymous] enum
O valor retornado pela função virtual ` type()`.
| Constante | Valor | Descrição |
|---|---|---|
QGraphicsPathItem::Type | 2 | Um item de caminho gráfico |
Documentação da função membro
[explicit] QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent = nullptr)
Cria um QGraphicsPath. O objeto ` parent ` é passado para o construtor de ` QAbstractGraphicsShapeItem`.
Veja também QGraphicsScene::addItem().
[explicit] QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
Cria um item QGraphicsPath usando ` path ` como caminho padrão. ` parent ` é passado ao construtor de ` QAbstractGraphicsShapeItem`.
Veja também QGraphicsScene::addItem().
[virtual noexcept] QGraphicsPathItem::~QGraphicsPathItem()
Destrói o 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
Retorna o caminho do item como um objeto ` QPainterPath`. Se nenhum item tiver sido definido, é retornado um objeto ` QPainterPath ` vazio.
Veja também setPath().
void QGraphicsPathItem::setPath(const QPainterPath &path)
Define o caminho do item como o endereço path fornecido.
Veja também 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.