Класс QGraphicsPathItem
Класс QGraphicsPathItem предоставляет элемент пути, который можно добавить в QGraphicsScene. Подробнее...
| Заголовок: | #include <QGraphicsPathItem> |
| qmake: | QT += widgets |
| С тех пор: | Qt 4.2 |
| Наследует: | QAbstractGraphicsShapeItem |
Этот класс был представлен в Qt 4.2.
Открытые типы
| перечисление | безымянный { Тип } |
Открытые функции
| QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr) | |
| QGraphicsPathItem(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 |
Подробное описание
Чтобы задать путь элемента, передайте 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-5.15/qgraphicspathitem.html