QAbstractGraphicsShapeItem Class

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

Header: #include <QAbstractGraphicsShapeItem>
qmake: QT += widgets
Since: Qt 4.2
Inherits: QGraphicsItem
Inherited By:

QGraphicsEllipseItem, QGraphicsPathItem, QGraphicsPolygonItem, QGraphicsRectItem, and QGraphicsSimpleTextItem

Public Functions

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

Reimplemented Public Functions

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

Additional Inherited Members

Detailed Description

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.

See also QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsPathItem, QGraphicsPolygonItem, QGraphicsTextItem, QGraphicsLineItem, QGraphicsPixmapItem, and Graphics View Framework.

Member Function Documentation

QAbstractGraphicsShapeItem::QAbstractGraphicsShapeItem(QGraphicsItem *parent = nullptr)

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

[virtual] QAbstractGraphicsShapeItem::~QAbstractGraphicsShapeItem()

Destroys a QAbstractGraphicsShapeItem.

QBrush QAbstractGraphicsShapeItem::brush() const

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

See also setBrush().

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

Reimplemented from QGraphicsItem::isObscuredBy().

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

Reimplemented from 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.

See also 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.

See also 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.

See also pen().

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support