The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene . 更多...
头: | #include <QGraphicsPolygonItem> |
qmake: | QT += widgets |
Since: | Qt 4.2 |
继承: | QAbstractGraphicsShapeItem |
QGraphicsPolygonItem (QGraphicsItem * parent = Q_NULLPTR) | |
QGraphicsPolygonItem (const QPolygonF & polygon , QGraphicsItem * parent = Q_NULLPTR) | |
~QGraphicsPolygonItem () | |
Qt::FillRule | fillRule () const |
QPolygonF | polygon () const |
void | setFillRule (Qt::FillRule rule ) |
void | setPolygon (const QPolygonF & polygon ) |
virtual QRectF | boundingRect () const |
virtual bool | contains (const QPointF & point ) const |
virtual bool | isObscuredBy (const QGraphicsItem * item ) const |
virtual QPainterPath | opaqueArea () const |
virtual void | paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR) |
virtual QPainterPath | shape () const |
virtual int | type () const |
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 ,和 图形视图框架 .
构造 QGraphicsPolygonItem . parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。
另请参阅 QGraphicsScene::addItem ().
构造 QGraphicsPolygonItem with polygon 作为默认多边形。 parent 会被传递给 QAbstractGraphicsShapeItem 的构造函数。
另请参阅 QGraphicsScene::addItem ().
销毁 QGraphicsPolygonItem .
[虚拟]
QRectF
QGraphicsPolygonItem::
boundingRect
() const
重实现自 QGraphicsItem::boundingRect ().
[虚拟]
bool
QGraphicsPolygonItem::
contains
(const
QPointF
&
point
) const
重实现自 QGraphicsItem::contains ().
返回多边形填充规则。默认填充规则为 Qt::OddEvenFill .
另请参阅 setFillRule (), QPainterPath::fillRule (),和 QPainter::drawPolygon ().
[虚拟]
bool
QGraphicsPolygonItem::
isObscuredBy
(const
QGraphicsItem
*
item
) const
重实现自 QGraphicsItem::isObscuredBy ().
[虚拟]
QPainterPath
QGraphicsPolygonItem::
opaqueArea
() const
重实现自 QGraphicsItem::opaqueArea ().
[虚拟]
void
QGraphicsPolygonItem::
paint
(
QPainter
*
painter
, const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
= Q_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 ().
[虚拟]
QPainterPath
QGraphicsPolygonItem::
shape
() const
重实现自 QGraphicsItem::shape ().
[虚拟]
int
QGraphicsPolygonItem::
type
() const
重实现自 QGraphicsItem::type ().