QGraphicsPolygonItem Class
QGraphicsPolygonItemクラスは、QGraphicsScene に追加できるポリゴンアイテムを提供します。
ヘッダー | #include <QGraphicsPolygonItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
継承: | QAbstractGraphicsShapeItem |
パブリックな型
enum | anonymous { Type } |
パブリック関数
QGraphicsPolygonItem(QGraphicsItem *parent = nullptr) | |
QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr) | |
virtual | ~QGraphicsPolygonItem() |
Qt::FillRule | fillRule() const |
QPolygonF | polygon() const |
void | setFillRule(Qt::FillRule rule) |
void | setPolygon(const QPolygonF &polygon) |
再実装されたパブリック関数
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 |
詳しい説明
アイテムのポリゴンを設定するには、QPolygonF を QGraphicsPolygonItem のコンストラクタに渡すか、setPolygon() 関数を呼び出します。polygon() 関数は現在のポリゴンを返します。
QGraphicsPolygonItem は、多角形とペン幅を使用して、boundingRect()、shape()、contains() の妥当な実装を提供します。paint() 関数は、アイテムに関連付けられたペンとブラシを使用して多角形を描画します。このペンとブラシは、setPen() 関数とsetBrush() 関数を呼び出すことで設定できます。
QGraphicsPathItem,QGraphicsRectItem,QGraphicsEllipseItem,QGraphicsTextItem,QGraphicsLineItem,QGraphicsPixmapItem, およびGraphics View Frameworkも参照のこと 。
メンバ型ドキュメント
enum QGraphicsPolygonItem::anonymous
仮想type() 関数が返す値。
定数 | 値 | 説明 |
---|---|---|
QGraphicsPolygonItem::Type | 5 | グラフィックスポリゴン項目 |
メンバ関数ドキュメント
[explicit]
QGraphicsPolygonItem::QGraphicsPolygonItem(QGraphicsItem *parent = nullptr)
QGraphicsPolygonItem を構築します。parent はQAbstractGraphicsShapeItem のコンストラクタに渡されます。
QGraphicsScene::addItem()も参照してください 。
[explicit]
QGraphicsPolygonItem::QGraphicsPolygonItem(const QPolygonF &polygon, QGraphicsItem *parent = nullptr)
polygon をデフォルトのポリゴンとして QGraphicsPolygonItem を構築します。parent はQAbstractGraphicsShapeItem のコンストラクタに渡されます。
QGraphicsScene::addItem()も参照してください 。
[virtual noexcept]
QGraphicsPolygonItem::~QGraphicsPolygonItem()
QGraphicsPolygonItem を破壊する。
[override virtual]
QRectF QGraphicsPolygonItem::boundingRect() const
再実装:QGraphicsItem::boundingRect() const.
[override virtual]
bool QGraphicsPolygonItem::contains(const QPointF &point) const
再実装:QGraphicsItem::contains(const QPointF &point) const.
Qt::FillRule QGraphicsPolygonItem::fillRule() const
多角形の塗りつぶし規則を返します。デフォルトの塗りつぶし規則はQt::OddEvenFill です。
setFillRule(),QPainterPath::fillRule(),QPainter::drawPolygon()も参照 。
[override virtual]
bool QGraphicsPolygonItem::isObscuredBy(const QGraphicsItem *item) const
再実装:QAbstractGraphicsShapeItem::isObscuredBy(const QGraphicsItem *item) const.
[override virtual]
QPainterPath QGraphicsPolygonItem::opaqueArea() const
再実装:QAbstractGraphicsShapeItem::opaqueArea() const.
[override virtual]
void QGraphicsPolygonItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)
再実装:QGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)。
QPolygonF QGraphicsPolygonItem::polygon() const
アイテムのポリゴン、またはポリゴンが設定されていない場合は空のポリゴンを返します。
setPolygon()も参照してください 。
void QGraphicsPolygonItem::setFillRule(Qt::FillRule rule)
多角形の塗りつぶし規則をrule に設定します。 デフォルトの塗りつぶし規則はQt::OddEvenFill です。
fillRule(),QPainterPath::fillRule(),QPainter::drawPolygon()も参照してください 。
void QGraphicsPolygonItem::setPolygon(const QPolygonF &polygon)
アイテムのポリゴンを指定されたpolygon に設定します。
polygon()も参照してください 。
[override virtual]
QPainterPath QGraphicsPolygonItem::shape() const
再実装:QGraphicsItem::shape() const.
[override virtual]
int QGraphicsPolygonItem::type() const
再実装:QGraphicsItem::type() const.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.