QGraphicsPolygonItem Class
Die Klasse QGraphicsPolygonItem stellt ein Polygonelement bereit, das Sie einem QGraphicsScene hinzufügen können. Mehr...
Kopfzeile: | #include <QGraphicsPolygonItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
Vererbt: | QAbstractGraphicsShapeItem |
Öffentliche Typen
enum | anonymous { Type } |
Öffentliche Funktionen
QGraphicsPolygonItem(QGraphicsItem *parent = nullptr) | |
QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr) | |
virtual | ~QGraphicsPolygonItem() |
Qt::FillRule | fillRule() const |
QPolygonF | polygon() const |
void | setFillRule(Qt::FillRule rule) |
void | setPolygon(const QPolygonF &polygon) |
Reimplementierte ö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 |
Detaillierte Beschreibung
Um das Polygon des Elements zu setzen, übergeben Sie ein QPolygonF an den Konstruktor von QGraphicsPolygonItem oder rufen Sie die Funktion setPolygon() auf. Die Funktion polygon() gibt das aktuelle Polygon zurück.
QGraphicsPolygonItem verwendet das Polygon und die Stiftbreite, um eine sinnvolle Implementierung von boundingRect(), shape() und contains() zu ermöglichen. Die Funktion paint() zeichnet das Polygon unter Verwendung des dem Element zugeordneten Stifts und Pinsels, die Sie durch Aufruf der Funktionen setPen() und setBrush() einstellen können.
Siehe auch QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem, und Graphics View Framework.
Dokumentation der Mitgliedstypen
enum QGraphicsPolygonItem::anonymous
Der Wert, der von der virtuellen Funktion type() zurückgegeben wird.
Konstante | Wert | Beschreibung |
---|---|---|
QGraphicsPolygonItem::Type | 5 | Ein Grafikpolygonelement |
Dokumentation der Mitgliedsfunktionen
[explicit]
QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent = nullptr)
Konstruiert ein QGraphicsPolygonItem. parent wird an den Konstruktor von QAbstractGraphicsShapeItem übergeben.
Siehe auch QGraphicsScene::addItem().
[explicit]
QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr)
Konstruiert ein QGraphicsPolygonItem mit polygon als Standardpolygon. parent wird an den Konstruktor von QAbstractGraphicsShapeItem übergeben.
Siehe auch QGraphicsScene::addItem().
[virtual noexcept]
QGraphicsPolygonItem::~QGraphicsPolygonItem()
Zerstört die QGraphicsPolygonItem.
[override virtual]
QRectF QGraphicsPolygonItem::boundingRect() const
Reimplements: QGraphicsItem::boundingRect() const.
[override virtual]
bool QGraphicsPolygonItem::contains(const QPointF &point) const
Reimplements: QGraphicsItem::contains(const QPointF &point) const.
Qt::FillRule QGraphicsPolygonItem::fillRule() const
Gibt die Füllregel des Polygons zurück. Die Standardfüllregel ist Qt::OddEvenFill.
Siehe auch setFillRule(), QPainterPath::fillRule(), und QPainter::drawPolygon().
[override virtual]
bool QGraphicsPolygonItem::isObscuredBy(const QGraphicsItem *item) const
Reimplements: QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const.
[override virtual]
QPainterPath QGraphicsPolygonItem::opaqueArea() const
Reimplements: QAbstractGraphicsShapeItem::opaqueArea() const.
[override virtual]
void QGraphicsPolygonItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
Reimplements: QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget).
QPolygonF QGraphicsPolygonItem::polygon() const
Liefert das Polygon des Objekts oder ein leeres Polygon, wenn kein Polygon festgelegt wurde.
Siehe auch setPolygon().
void QGraphicsPolygonItem::setFillRule(Qt::FillRule rule)
Setzt die Füllregel des Polygons auf rule. Die Standardfüllregel ist Qt::OddEvenFill.
Siehe auch fillRule(), QPainterPath::fillRule(), und QPainter::drawPolygon().
void QGraphicsPolygonItem::setPolygon(const QPolygonF &polygon)
Setzt das Polygon des Objekts auf das angegebene polygon.
Siehe auch polygon().
[override virtual]
QPainterPath QGraphicsPolygonItem::shape() const
Reimplements: QGraphicsItem::shape() const.
[override virtual]
int QGraphicsPolygonItem::type() const
Reimplements: 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.