Класс 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.2/qgraphicspathitem.html