libs/flake
KoSelection Class Reference
A selection is a shape that contains a number of references to shapes. More...
#include <KoSelection.h>

Signals | |
| void | currentLayerChanged (const KoShapeLayer *layer) |
| void | selectionChanged () |
Public Member Functions | |
| KoSelection () | |
| virtual | ~KoSelection () |
| KoShapeLayer * | activeLayer () const |
| virtual QRectF | boundingRect () const |
| int | count () const |
| void | deselect (KoShape *shape, bool recursive=true) |
| void | deselectAll () |
| KoShape * | firstSelectedShape (KoFlake::SelectionType strip=KoFlake::FullSelection) const |
| virtual bool | hitTest (const QPointF &position) const |
| bool | isSelected (const KoShape *shape) const |
| virtual void | paint (QPainter &painter, const KoViewConverter &converter) |
| void | select (KoShape *shape, bool recursive=true) |
| const QList< KoShape * > | selectedShapes (KoFlake::SelectionType strip=KoFlake::FullSelection) const |
| void | setActiveLayer (KoShapeLayer *layer) |
| void | updateSizeAndPosition () |
Detailed Description
A selection is a shape that contains a number of references to shapes.
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.
Definition at line 52 of file KoSelection.h.
Constructor & Destructor Documentation
| KoSelection::KoSelection | ( | ) |
Definition at line 114 of file KoSelection.cpp.
| KoSelection::~KoSelection | ( | ) | [virtual] |
Definition at line 119 of file KoSelection.cpp.
Member Function Documentation
| KoShapeLayer * KoSelection::activeLayer | ( | ) | const |
Returns a currently active layer.
- Returns:
- the currently active layer, or zero if there is none
Definition at line 322 of file KoSelection.cpp.
| QRectF KoSelection::boundingRect | ( | ) | const [virtual] |
Get the bounding box of the shape.
This includes the line width but not the shadow of the shape
- Returns:
- the bounding box of the shape
Reimplemented from KoShape.
Definition at line 261 of file KoSelection.cpp.
| int KoSelection::count | ( | ) | const |
return the selection count, i.e. the number of all selected shapes
Definition at line 230 of file KoSelection.cpp.
| void KoSelection::currentLayerChanged | ( | const KoShapeLayer * | layer | ) | [signal] |
emitted when the current layer is changed
| void KoSelection::deselect | ( | KoShape * | shape, | |
| bool | recursive = true | |||
| ) |
Removes a selected shape.
If the shape is a KoShapeGroup all of its child shapes are automatically removed from the selection. If the shape has no parent or is not a KoShapeGroup, only the given shape is removed from the selection. If the given shape is a child of a KoShapeGroup and recursive selection is enabled the all parents and their child shape up to the toplevel KoShapeGroup are removed from the selection.
- Parameters:
-
shape the shape to remove from the selection recursive enables recursively deselecting shapes of parent groups
Definition at line 190 of file KoSelection.cpp.
| void KoSelection::deselectAll | ( | ) |
clear the selections list
Definition at line 218 of file KoSelection.cpp.
| KoShape * KoSelection::firstSelectedShape | ( | KoFlake::SelectionType | strip = KoFlake::FullSelection |
) | const |
Return the first selected shape, or 0 if there is nothing selected.
- Parameters:
-
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.
Definition at line 307 of file KoSelection.cpp.
| bool KoSelection::hitTest | ( | const QPointF & | position | ) | const [virtual] |
Check if the shape is hit on position.
- Parameters:
-
position the position where the user clicked.
- Returns:
- true when it hits.
Reimplemented from KoShape.
Definition at line 240 of file KoSelection.cpp.
| bool KoSelection::isSelected | ( | const KoShape * | shape | ) | const |
return true if the shape is selected
Definition at line 293 of file KoSelection.cpp.
| 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.
- Parameters:
-
painter used for painting the shape converter to convert between internal and view coordinates.
- See also:
- applyConversion()
Implements KoShape.
Definition at line 123 of file KoSelection.cpp.
| void KoSelection::select | ( | KoShape * | shape, | |
| bool | recursive = true | |||
| ) |
Adds a shape to the selection.
If the shape is a KoShapeGroup all of its child shapes are automatically added to the selection. If the shape has no parent or is not a KoShapeGroup, only the given shape is added to the selection. If the given shape is a child of a KoShapeGroup and recursive selection is enabled the all parents and their child shapes up to the toplevel KoShapeGroup are added to the selection.
- Parameters:
-
shape the shape to add to the selection recursive enables recursively selecting shapes of parent groups
Definition at line 129 of file KoSelection.cpp.
| const QList< KoShape * > KoSelection::selectedShapes | ( | KoFlake::SelectionType | strip = KoFlake::FullSelection |
) | const |
Return the list of selected shapes.
- Returns:
- the list of selected shapes
- Parameters:
-
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.
Definition at line 266 of file KoSelection.cpp.
| void KoSelection::selectionChanged | ( | ) | [signal] |
emitted when the selection is changed
| void KoSelection::setActiveLayer | ( | KoShapeLayer * | layer | ) |
Sets the currently active layer.
- Parameters:
-
layer the new active layer
Definition at line 315 of file KoSelection.cpp.
| void KoSelection::updateSizeAndPosition | ( | ) |
Updates the size and position of the selection.
Definition at line 251 of file KoSelection.cpp.
The documentation for this class was generated from the following files:
