Класс QGraphicsPathItem
Класс QGraphicsPathItem предоставляет элемент пути, который можно добавить в QGraphicsScene. Подробнее...
| Заголовок: | #include <QGraphicsPathItem> |
| CMake: | find_package(Qt6 COMPONENTS Widgets REQUIRED) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
| qmake: | QT += widgets |
| Наследует: | QAbstractGraphicsShapeItem |
Открытые типы
| Перечисление | безымянный { Type } |
Открытые функции
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(QGraphicsItem *parent = nullptr) | |
| виртуальный | ~QGraphicsPathItem() |
| QPainterPath | path() const |
| void | setPath(const QPainterPath &path) |
Переопределённые открытые функции
| виртуальный QRectF | boundingRect() const override |
| виртуальный bool | contains(const QPointF &point) const override |
| виртуальный bool | isObscuredBy(const QGraphicsItem *item) const override |
| виртуальный QPainterPath | opaqueArea() const override |
| виртуальный void | paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override |
| виртуальный QPainterPath | shape() const override |
| виртуальный int | type() const override |
Подробное описание
Для установки пути элемента передайте QPainterPath в конструктор QGraphicsPathItem или вызовите функцию setPath(). Функция path() возвращает текущий путь.
QGraphicsPathItem использует путь для предоставления разумной реализации boundingRect(), shape() и contains(). Функция paint() рисует путь с использованием пера и кисти, связанных с элементом, которые можно установить, вызвав функции setPen() и setBrush().
См. также QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem и Графическая система отображения.
Документация по типам членов
Перечисление QGraphicsPathItem::безымянный
Значение, возвращаемое виртуальной функцией type().
| Константа | Значение | Описание |
|---|---|---|
QGraphicsPathItem::Type |
2 |
Элемент графического пути |
Документация по функциям-членам
QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
Создаёт элемент QGraphicsPath с 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.0/qgraphicspathitem.html