QAbstractGraphicsShapeItem Class

The QAbstractGraphicsShapeItem class provides a common base for all path items. 更多...

头文件: #include <QAbstractGraphicsShapeItem>
qmake: QT += widgets
开始支持版本: Qt 4.2
基类: QGraphicsItem
派生类:

QGraphicsEllipseItem, QGraphicsPathItem, QGraphicsPolygonItem, QGraphicsRectItem, and QGraphicsSimpleTextItem

公有函数

QAbstractGraphicsShapeItem(QGraphicsItem *parent = Q_NULLPTR)
~QAbstractGraphicsShapeItem()
QBrush brush() const
QPen pen() const
void setBrush(const QBrush &brush)
void setPen(const QPen &pen)

重新实现的公有函数

virtual bool isObscuredBy(const QGraphicsItem *item) const
virtual QPainterPath opaqueArea() const

其他继承的成员

详细描述

The QAbstractGraphicsShapeItem class provides a common base for all path items.

This class does not fully implement an item by itself; in particular, it does not implement boundingRect() and paint(), which are inherited by QGraphicsItem.

You can subclass this item to provide a simple base implementation of accessors for the item's pen and brush.

参见 QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPathItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem, and Graphics View Framework.

成员函数

QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QGraphicsItem *parent = Q_NULLPTR)

Constructs a QAbstractGraphicsShapeItem. parent is passed to QGraphicsItem's constructor.

QAbstractGraphicsShapeItem::~QAbstractGraphicsShapeItem()

Destroys a QAbstractGraphicsShapeItem.

QBrush QAbstractGraphicsShapeItem::brush() const

Returns the item's brush, or an empty brush if no brush has been set.

参见 setBrush().

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

重新实现 QGraphicsItem::isObscuredBy().

[virtual] QPainterPath QAbstractGraphicsShapeItem::opaqueArea() const

重新实现 QGraphicsItem::opaqueArea().

QPen QAbstractGraphicsShapeItem::pen() const

Returns the item's pen. If no pen has been set, this function returns QPen(), a default black solid line pen with 1 width.

参见 setPen().

void QAbstractGraphicsShapeItem::setBrush(const QBrush &brush)

Sets the item's brush to brush.

The item's brush is used to fill the item.

If you use a brush with a QGradient, the gradient is relative to the item's coordinate system.

参见 brush().

void QAbstractGraphicsShapeItem::setPen(const QPen &pen)

Sets the pen for this item to pen.

The pen is used to draw the item's outline.

参见 pen().