QGraphicsPathItem Class
Die Klasse „QGraphicsPathItem“ stellt ein Pfadelement bereit, das Sie einem „ QGraphicsScene “ hinzufügen können. Mehr...
| Header: | #include <QGraphicsPathItem> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| Erbt von: | QAbstractGraphicsShapeItem |
Öffentliche Typen
| enum { Type } |
Öffentliche Funktionen
| QGraphicsPathItem(QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsPathItem() |
| QPainterPath | path() const |
| void | setPath(const QPainterPath &path) |
Neu implementierte öffentliche Funktionen
| 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 |
Ausführliche Beschreibung
Um den Pfad des Elements festzulegen, übergeben Sie ein ` QPainterPath ` an den Konstruktor von `QGraphicsPathItem` oder rufen Sie die Funktion ` setPath()` auf. Die Funktion ` path()` gibt den aktuellen Pfad zurück.

QGraphicsPathItem nutzt den Pfad, um eine sinnvolle Implementierung der Funktionen ` boundingRect()`, ` shape()` und ` contains()` bereitzustellen. Die Funktion ` paint()` zeichnet den Pfad mit dem dem Element zugeordneten Stift und Pinsel, die Sie durch Aufruf der Funktionen ` setPen()` und ` setBrush()` festlegen können.
Siehe auch „ QGraphicsRectItem“ , „ QGraphicsEllipseItem “, „ QGraphicsPolygonItem “, „ QGraphicsTextItem “, „ QGraphicsLineItem “, „ QGraphicsPixmapItem “ und „Graphics View Framework“.
Dokumentation zu Mitgliedstypen
[anonymous] enum
Der von der virtuellen Funktion ` type()` zurückgegebene Wert.
| Konstante | Wert | Beschreibung |
|---|---|---|
QGraphicsPathItem::Type | 2 | Ein Grafikpfadelement |
Dokumentation der Mitgliedsfunktionen
[explicit] QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent = nullptr)
Erstellt einen `QGraphicsPath`. ` parent ` wird an den Konstruktor von ` QAbstractGraphicsShapeItem` übergeben.
Siehe auch QGraphicsScene::addItem().
[explicit] QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
Erstellt ein QGraphicsPath-Element unter Verwendung von „ path “ als Standardpfad. „ parent “ wird an den Konstruktor von „ QAbstractGraphicsShapeItem “ übergeben.
Siehe auch QGraphicsScene::addItem().
[virtual noexcept] QGraphicsPathItem::~QGraphicsPathItem()
Zerstört den „ QGraphicsPathItem “.
[override virtual] QRectF QGraphicsPathItem::boundingRect() const
Implementiert: ` QGraphicsItem::boundingRect()` const.
[override virtual] bool QGraphicsPathItem::contains(const QPointF &point) const
Implementiert neu: ` QGraphicsItem::contains(const QPointF &point) const`.
[override virtual] bool QGraphicsPathItem::isObscuredBy(const QGraphicsItem *item) const
Implementiert: ` QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const`.
[override virtual] QPainterPath QGraphicsPathItem::opaqueArea() const
Implementiert erneut: ` QAbstractGraphicsShapeItem::opaqueArea()` const.
[override virtual] void QGraphicsPathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
Implementiert: ` QGraphicsItem::paint` (`QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget`).
QPainterPath QGraphicsPathItem::path() const
Gibt den Pfad des Elements als ` QPainterPath` zurück. Wenn kein Element festgelegt wurde, wird ein leeres ` QPainterPath ` zurückgegeben.
Siehe auch setPath().
void QGraphicsPathItem::setPath(const QPainterPath &path)
Legt den Pfad des Elements auf die angegebene Adresse path fest.
Siehe auch path().
[override virtual] QPainterPath QGraphicsPathItem::shape() const
Implementiert: ` QGraphicsItem::shape()` const.
[override virtual] int QGraphicsPathItem::type() const
Implementiert: ` 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.