#include <KoSelection.h>
Inheritance diagram for KoSelection:

Signals | |
| void | selectionChanged () |
| emitted when the selection is changed | |
Public Member Functions | |
| virtual void | paint (QPainter &painter, const KoViewConverter &converter) |
| Paint the shape The class extending this one is responsible for painting itself. | |
| virtual void | select (KoShape *object) |
| add a selected object | |
| virtual void | deselect (KoShape *object) |
| remove a selected object | |
| virtual void | deselectAll () |
| clear the selections list | |
| virtual const QList< KoShape * > | selectedShapes (KoFlake::SelectionType strip=KoFlake::FullSelection) const |
| Return the list of selected shapes. | |
| KoShape * | firstSelectedShape (KoFlake::SelectionType strip=KoFlake::FullSelection) const |
| Return the first selected shape, or 0 if there is nothing selected. | |
| virtual bool | isSelected (const KoShape *object) const |
| return true if the shape is selected | |
| virtual int | count () const |
| return the selection count | |
| virtual bool | hitTest (const QPointF &position) const |
| Check if the shape is hit on position. | |
| virtual QRectF | boundingRect () const |
| Get the bounding box of the shape. | |
| void | setActiveLayer (KoShapeLayer *layer) |
| Sets the currently active layer. | |
| KoShapeLayer * | activeLayer () const |
| Returns a currently active layer. | |
| void | updateSizeAndPosition () |
| Updates the size and position of the selection. | |
That means that a selection can be manipulated in the same way as a single shape.
Note that a single shape can be selected in one view, and not in another, and that in a single view, more than one selection can be present. So selections should not be seen as singletons, or as something completely transient.
A selection, however, should not be selectable. We need to think a little about the interaction here.
| KoShapeLayer * KoSelection::activeLayer | ( | ) | const |
Returns a currently active layer.
| QRectF KoSelection::boundingRect | ( | ) | const [virtual] |
Get the bounding box of the shape.
This includes the line width but not the shadow of the shape
Reimplemented from KoShape.
| KoShape * KoSelection::firstSelectedShape | ( | KoFlake::SelectionType | strip = KoFlake::FullSelection |
) | const |
Return the first selected shape, or 0 if there is nothing selected.
| strip | if StrippedSelection, the returned list will not include any children of a grouped shape if the group-parent is itself also in the set. |
| bool KoSelection::hitTest | ( | const QPointF & | position | ) | const [virtual] |
Check if the shape is hit on position.
| position | the position where the user clicked. |
Reimplemented from KoShape.
| void KoSelection::paint | ( | QPainter & | painter, | |
| const KoViewConverter & | converter | |||
| ) | [virtual] |
Paint the shape The class extending this one is responsible for painting itself.
Since we do not assume the shape is square the paint must also clear its background if it will draw something transparent on top. This can be done with a method like: painter.fillRect(converter.normalToView(QRectF(QPointF(0.0,0.0), size())), background()); Or equavalent for non-square objects. Do note that a shape's top-left is always at coordinate 0,0. Even if the shape itself is rotated or translated.
| painter | used for painting the shape | |
| converter | to convert between internal and view coordinates. |
Implements KoShape.
| const QList< KoShape * > KoSelection::selectedShapes | ( | KoFlake::SelectionType | strip = KoFlake::FullSelection |
) | const [virtual] |
Return the list of selected shapes.
| strip | if StrippedSelection, the returned list will not include any children of a container shape if the container-parent is itself also in the set. |
| void KoSelection::setActiveLayer | ( | KoShapeLayer * | layer | ) |
Sets the currently active layer.
| layer | the new active layer |
1.4.7