The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene . 更多...
头: | #include <QGraphicsPolygonItem> |
qmake: | QT += widgets |
Since: | Qt 4.2 |
继承: | 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 |
The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene .
要设置项的多边形,传递 QPolygonF to QGraphicsPolygonItem 's constructor, or call the setPolygon () 函数。 polygon () 函数返回当前多边形。
QGraphicsPolygonItem uses the polygon and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () function draws the polygon using the item's associated pen and brush, which you can set by calling the setPen () 和 setBrush () 函数。
另请参阅 QGraphicsPathItem , QGraphicsRectItem , QGraphicsEllipseItem , QGraphicsTextItem , QGraphicsLineItem , QGraphicsPixmapItem ,和 图形视图框架 .
值的返回通过虚拟 type () 函数。
常量 | 值 | 描述 |
---|---|---|
QGraphicsPolygonItem::Type
|
5
|
A graphics polygon item |
构造 QGraphicsPolygonItem . parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。
另请参阅 QGraphicsScene::addItem ().
构造 QGraphicsPolygonItem with polygon 作为默认多边形。 parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。
另请参阅 QGraphicsScene::addItem ().
[虚拟]
QGraphicsPolygonItem::
~QGraphicsPolygonItem
()
销毁 QGraphicsPolygonItem .
[override virtual]
QRectF
QGraphicsPolygonItem::
boundingRect
() const
重实现自 QGraphicsItem::boundingRect ().
[override virtual]
bool
QGraphicsPolygonItem::
contains
(const
QPointF
&
point
) const
重实现自 QGraphicsItem::contains ().
返回多边形填充规则。默认填充规则为 Qt::OddEvenFill .
另请参阅 setFillRule (), QPainterPath::fillRule (),和 QPainter::drawPolygon ().
[override virtual]
bool
QGraphicsPolygonItem::
isObscuredBy
(const
QGraphicsItem
*
item
) const
重实现自 QAbstractGraphicsShapeItem::isObscuredBy ().
[override virtual]
QPainterPath
QGraphicsPolygonItem::
opaqueArea
() const
重实现自 QAbstractGraphicsShapeItem::opaqueArea ().
[override virtual]
void
QGraphicsPolygonItem::
paint
(
QPainter
*
painter
, const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
= nullptr)
重实现自 QGraphicsItem::paint ().
Returns the item's polygon, or an empty polygon if no polygon has been set.
另请参阅 setPolygon ().
Sets the fill rule of the polygon to rule . The default fill rule is Qt::OddEvenFill .
另请参阅 fillRule (), QPainterPath::fillRule (),和 QPainter::drawPolygon ().
将项的多边形设为给定 polygon .
另请参阅 polygon ().
[override virtual]
QPainterPath
QGraphicsPolygonItem::
shape
() const
重实现自 QGraphicsItem::shape ().
[override virtual]
int
QGraphicsPolygonItem::
type
() const
重实现自 QGraphicsItem::type ().