このページでは

QGraphicsEllipseItem Class

QGraphicsEllipseItem クラスは、QGraphicsScene に追加できる楕円アイテムを提供します。詳細...

ヘッダー: #include <QGraphicsEllipseItem>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
継承元: QAbstractGraphicsShapeItem

パブリック型

enum { Type }

パブリック関数

QGraphicsEllipseItem(QGraphicsItem *parent = nullptr)
QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = nullptr)
QGraphicsEllipseItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent = nullptr)
virtual ~QGraphicsEllipseItem()
QRectF rect() const
void setRect(const QRectF &rect)
void setRect(qreal x, qreal y, qreal width, qreal height)
void setSpanAngle(int angle)
void setStartAngle(int angle)
int spanAngle() const
int startAngle() const

再実装されたパブリック関数

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

詳細な説明

QGraphicsEllipseItem は、塗りつぶしと外枠を持つ楕円を表します。また、楕円のセグメントにも使用できます(startAngle()、spanAngle() を参照)。

完全な楕円形開始角とスパン角を持つ楕円形状

アイテムの楕円を設定するには、QRectF を QGraphicsEllipseItem のコンストラクタに渡すか、setRect() を呼び出します。rect() 関数は、現在の楕円のジオメトリを返します。

QGraphicsEllipseItemは、rectとペン幅を使用して、boundingRect()、shape()、およびcontains()の適切な実装を提供します。paint()関数は、アイテムに関連付けられたペンとブラシを使用して楕円を描画します。これらの設定は、setPen()およびsetBrush()を呼び出すことで行えます。

QGraphicsPathItem 、QGraphicsRectItem 、QGraphicsPolygonItem 、QGraphicsTextItem 、QGraphicsLineItem 、QGraphicsPixmapItem 、およびGraphics View Frameworkも参照してください 。

メンバ型のドキュメント

[anonymous] enum

仮想関数type()が返す値。

定数値説明
QGraphicsEllipseItem::Type4グラフィックス楕円アイテム

メンバ関数のドキュメント

[explicit] QGraphicsEllipseItem::QGraphicsEllipseItem(QGraphicsItem *parent = nullptr)

QGraphicsEllipseItem を生成します。parent は、QAbstractGraphicsShapeItem のコンストラクタに渡されます。

QGraphicsScene::addItem()も参照してください 。

[explicit] QGraphicsEllipseItem::QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = nullptr)

rect をデフォルトの矩形として、QGraphicsEllipseItemを生成します。parent は、QAbstractGraphicsShapeItem のコンストラクタに渡されます。

QGraphicsScene::addItem()も参照してください 。

[explicit] QGraphicsEllipseItem::QGraphicsEllipseItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parent = nullptr)

(x,y) で定義された矩形と、指定されたwidth およびheight をデフォルトの矩形として使用して、QGraphicsEllipseItemを構築します。parent は、QAbstractGraphicsShapeItem のコンストラクタに渡されます。

QGraphicsScene::addItem()も参照してください 。

[virtual noexcept] QGraphicsEllipseItem::~QGraphicsEllipseItem()

QGraphicsEllipseItem を破棄します。

[override virtual] QRectF QGraphicsEllipseItem::boundingRect() const

QGraphicsItem::boundingRect() const を再実装します。

[override virtual] bool QGraphicsEllipseItem::contains(const QPointF &point) const

QGraphicsItem::contains (const QPointF &point)const を再実装します。

[override virtual] bool QGraphicsEllipseItem::isObscuredBy(const QGraphicsItem *item) const

QAbstractGraphicsShapeItem::isObscuredBy (const QGraphicsItem *item)const を再実装します。

[override virtual] QPainterPath QGraphicsEllipseItem::opaqueArea() const

QAbstractGraphicsShapeItem::opaqueArea() const を再実装します。

[override virtual] void QGraphicsEllipseItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr)

QGraphicsItem::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)を再実装します。

QRectF QGraphicsEllipseItem::rect() const

アイテムの楕円形状を、QRectF として返します。

setRect() およびQPainter::drawEllipse()も参照してください 。

void QGraphicsEllipseItem::setRect(const QRectF &rect)

アイテムの楕円形状を `rect` に設定します。矩形の左端が楕円の左端を定義し、矩形の上端が楕円の上端を表します。矩形の高さと幅は、楕円の高さと幅を表します。

rect() およびQPainter::drawEllipse()も参照してください 。

void QGraphicsEllipseItem::setRect(qreal x, qreal y, qreal width, qreal height)

アイテムの矩形を、(x 、y) で定義された矩形と、指定されたwidth およびheight に設定します。

この便利関数は、setRect(QRectF(x, y, width, height))

rect()も参照してください 。

void QGraphicsEllipseItem::setSpanAngle(int angle)

楕円セグメントのスパン角度を、angle (1度の16分の1単位)に設定します。この角度は、startAngle() と組み合わせて、楕円セグメント(円グラフ)を表すために使用されます。デフォルトでは、スパン角度は 5760(360 × 16、完全な楕円)です。

spanAngle()、setStartAngle()、およびQPainter::drawPie()も参照してください 。

void QGraphicsEllipseItem::setStartAngle(int angle)

楕円セグメントの開始角度をangle に設定します。この値は1度の16分の1単位です。この角度は、spanAngle()と組み合わせて、楕円セグメント(円弧)を表すために使用されます。デフォルトでは、開始角度は0です。

startAngle()、setSpanAngle()、およびQPainter::drawPie()も参照してください 。

[override virtual] QPainterPath QGraphicsEllipseItem::shape() const

QGraphicsItem::shape() const を再実装します。

int QGraphicsEllipseItem::spanAngle() const

楕円セグメントのスパン角を、16分の1度単位で返します。この角度は、startAngle() と組み合わせて、楕円セグメント(円グラフ)を表すために使用されます。デフォルトでは、この関数は 5760(360 × 16、完全な楕円)を返します。

setSpanAngle() およびstartAngle()も参照してください 。

int QGraphicsEllipseItem::startAngle() const

楕円セグメントの開始角度を16分の1度単位で返します。この角度は、spanAngle() と組み合わせて、楕円セグメント(円弧)を表すために使用されます。デフォルトでは、開始角度は0です。

setStartAngle() およびspanAngle()も参照してください 。

[override virtual] int QGraphicsEllipseItem::type() const

QGraphicsItem::type() const を再実装します。

© 2026 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.