Класс QGraphicsPathItem
Класс QGraphicsPathItem предоставляет элемент пути, который вы можете добавить в QGraphicsScene. Подробнее...
| Заголовок: | #include <QGraphicsPathItem> |
| CMake: | find_package(Qt6 COMPONENTS Widgets REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| Наследуется от: | QAbstractGraphicsShapeItem |
Типы public
| Перечисление | anonymous { Type } |
Public Функции
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsPathItem() |
| QPainterPath | path() const |
| void | setPath(const QPainterPath &path) |
Реализованные public Функции
| 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 и Графическая система отображения.
Документация по типам членов
Перечисление QGraphicsPathItem::anonymous
Значение, возвращаемое виртуальной функцией type().
| Константа | Значение | Описание |
|---|---|---|
QGraphicsPathItem::Type |
2 |
Элемент графического пути |
Документация по функциям-членам
QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
Конструирует элемент QGraphicsPathItem, используя path в качестве пути по умолчанию. parent передается конструктору QAbstractGraphicsShapeItem.
См. также QGraphicsScene::addItem().
QGraphicsPathItem::QGraphicsPathItem(QGraphicsItem *parent = nullptr)
Конструирует QGraphicsPath. parent передается конструктору QAbstractGraphicsShapeItem.
См. также QGraphicsScene::addItem().
[virtual] 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.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.1/qgraphicspathitem.html