Класс QGraphicsPathItem
Класс QGraphicsPathItem предоставляет элемент пути, который можно добавить в QGraphicsScene. Подробнее...
| Заголовок: | #include <QGraphicsPathItem> |
| qmake: | QT += widgets |
| С момента: | Qt 4.2 |
| Наследуется от: | QAbstractGraphicsShapeItem |
Открытые типы
| перечисление | anonymous { Type } |
Открытые функции
| QGraphicsPathItem(QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| virtual | ~QGraphicsPathItem() |
| QPainterPath | path() const |
| void | setPath(const QPainterPath &path) |
Переопределенные открытые функции
| 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 |
- 6 открытых функций, унаследованных от QAbstractGraphicsShapeItem
- 176 открытых функций, унаследованных от QGraphicsItem
Дополнительные унаследованные члены
- 24 защищенных функции, унаследованные от QGraphicsItem
Подробное описание
Класс QGraphicsPathItem предоставляет элемент пути, который можно добавить в QGraphicsScene.
Чтобы установить путь элемента, передайте 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(QGraphicsItem *parent = nullptr)
Создает QGraphicsPath. parent передается в конструктор QAbstractGraphicsShapeItem.
См. также QGraphicsScene::addItem().
QGraphicsPathItem::QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr)
Создает элемент QGraphicsPath с использованием path в качестве пути по умолчанию. parent передается в конструктор QAbstractGraphicsShapeItem.
См. также QGraphicsScene::addItem().
[virtual] QGraphicsPathItem::~QGraphicsPathItem()
Удаляет QGraphicsPathItem.
[override virtual] QRectF QGraphicsPathItem::boundingRect() const
Переопределено из QGraphicsItem::boundingRect().
[override virtual] bool QGraphicsPathItem::contains(const QPointF &point) const
Переопределено из QGraphicsItem::contains().
[override virtual] bool QGraphicsPathItem::isObscuredBy(const QGraphicsItem *item) const
Переопределено из QAbstractGraphicsShapeItem::isObscuredBy().
[override virtual] QPainterPath QGraphicsPathItem::opaqueArea() const
Переопределено из QAbstractGraphicsShapeItem::opaqueArea().
[override virtual] void QGraphicsPathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
Переопределено из QGraphicsItem::paint().
QPainterPath QGraphicsPathItem::path() const
Возвращает путь элемента как QPainterPath. Если элемент не задан, возвращается пустой QPainterPath.
См. также setPath().
void QGraphicsPathItem::setPath(const QPainterPath &path)
Устанавливает путь элемента в заданный path.
См. также path().
[override virtual] QPainterPath QGraphicsPathItem::shape() const
Переопределено из QGraphicsItem::shape().
[override virtual] int QGraphicsPathItem::type() const
Переопределено из QGraphicsItem::type().
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.12/qgraphicspathitem.html