BaseShapeItem class.
More...
#include <PainterGraphicsItems.h>
|
enum | ItemType {
BASE =0,
PAINT,
LINE,
RECT,
CIRCLE,
ELLIPSE,
POLYGON,
POLYLINE,
CURVE,
CLOSEDCURVE,
NUM_ITEMTYPES
} |
|
enum | { Type = UserType + 1
} |
|
|
| BaseShapeItem (QPen pen=QPen(), QBrush brush=QBrush()) |
| Constructor of the BaseShapeItem class.
|
|
virtual | ~BaseShapeItem () |
| Destructor of the PainterPanel class.
|
|
virtual int | type () const |
| Enable the use of qgraphicsitem_cast with this item.
|
|
virtual ItemType | GetItemType () |
| The item type is used to distinguish between the different types of items.
|
|
virtual void | addPosition (QPointF pos)=0 |
| Add a new position to this item.
|
|
virtual void | updatePosition (QPointF pos)=0 |
| Update the current position of this item.
|
|
virtual void | skipLastPosition (bool &emptyItem) |
| Forget the last position provided by add-/updatePosition()
|
|
virtual QRectF | boundingRect () const |
| Get the bounding-rect of the shape.
|
|
virtual void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
| Paint the item with the specified pen and brush Use a yellow pen when the item is selected.
|
|
QString | getDescriptionText () |
|
|
virtual void | updateShape () |
| Call this function to update the shape of the item. This function updates the position of the translation and rotation handle.
|
|
virtual QVariant | itemChange (GraphicsItemChange change, const QVariant &value) |
| React on changes of the item.
|
|
|
void | showHandles (bool show=true) |
| Show/Hide handles of the item.
|
|
BaseShapeItem class.
This class provides objects handles for bounding points, translation and rotation Implement functions addPosition( QPointF pos ) and updatePosition( QPointF pos ) for custom items
If you override updateShape() for complex shapes, don't forget to call prepareGeometryChange() at the beginning and BaseShapeItem::updateShape() at the end. This file also contains some examples.
- Enumerator:
BASE |
|
PAINT |
|
LINE |
|
RECT |
|
CIRCLE |
|
ELLIPSE |
|
POLYGON |
|
POLYLINE |
|
CURVE |
|
CLOSEDCURVE |
|
NUM_ITEMTYPES |
|
PainterPanel::BaseShapeItem::BaseShapeItem |
( |
QPen |
pen = QPen() , |
|
|
QBrush |
brush = QBrush() |
|
) |
| |
|
inline |
Constructor of the BaseShapeItem class.
- Parameters
-
penColor | The parent widget the created instance will be a child of. |
penWidth | Extra widget options. |
virtual PainterPanel::BaseShapeItem::~BaseShapeItem |
( |
| ) |
|
|
inlinevirtual |
Destructor of the PainterPanel class.
Defined virtual to guarantee that the destructor of a derived class will be called if the instance of the derived class is saved in a variable of its parent class type.
virtual int PainterPanel::BaseShapeItem::type |
( |
| ) |
const |
|
inlinevirtual |
Enable the use of qgraphicsitem_cast with this item.
virtual ItemType PainterPanel::BaseShapeItem::GetItemType |
( |
| ) |
|
|
inlinevirtual |
virtual void PainterPanel::BaseShapeItem::addPosition |
( |
QPointF |
pos | ) |
|
|
pure virtual |
virtual void PainterPanel::BaseShapeItem::updatePosition |
( |
QPointF |
pos | ) |
|
|
pure virtual |
virtual void PainterPanel::BaseShapeItem::skipLastPosition |
( |
bool & |
emptyItem | ) |
|
|
inlinevirtual |
virtual QRectF PainterPanel::BaseShapeItem::boundingRect |
( |
| ) |
const |
|
inlinevirtual |
Get the bounding-rect of the shape.
virtual void PainterPanel::BaseShapeItem::paint |
( |
QPainter * |
painter, |
|
|
const QStyleOptionGraphicsItem * |
option, |
|
|
QWidget * |
widget |
|
) |
| |
|
inlinevirtual |
Paint the item with the specified pen and brush Use a yellow pen when the item is selected.
Reimplemented in PainterPanel::CurveItem.
QString PainterPanel::BaseShapeItem::getDescriptionText |
( |
| ) |
|
|
inline |
virtual void PainterPanel::BaseShapeItem::updateShape |
( |
| ) |
|
|
inlineprotectedvirtual |
virtual QVariant PainterPanel::BaseShapeItem::itemChange |
( |
GraphicsItemChange |
change, |
|
|
const QVariant & |
value |
|
) |
| |
|
inlineprotectedvirtual |
void PainterPanel::BaseShapeItem::showHandles |
( |
bool |
show = true | ) |
|
|
inlineprivate |
Show/Hide handles of the item.
QPainterPath PainterPanel::BaseShapeItem::m_shape |
|
protected |
The shape of the item to draw.
QList<PointHandle*> PainterPanel::BaseShapeItem::m_points |
|
protected |
The list of point handles.
The handle to rotate this shape item.
The handle to translate this shape item.
The documentation for this class was generated from the following file: