#include <KoShapeManager.h>
Signals | |
| void | selectionChanged () |
| emitted when the selection is changed | |
| void | selectionContentChanged () |
| emitted when an object in the selection is changed (moved/rotated etc) | |
Public Member Functions | |
| KoShapeManager (KoCanvasBase *canvas) | |
| Empty constructor. | |
| KoShapeManager (KoCanvasBase *canvas, const QList< KoShape * > &shapes) | |
| Constructor that takes a list of shapes, convenience version. | |
| void | setShapes (const QList< KoShape * > &shapes, bool repaint=true) |
| Remove all previously owned shapes and make the argument list the new shapes to be managed by this manager. | |
| const QList< KoShape * > & | shapes () const |
| returns the list of maintained shapes | |
| void | add (KoShape *shape) |
| Add a KoShape to be displayed and managed by this manager. | |
| void | remove (KoShape *shape) |
| Remove a KoShape from this manager. | |
| KoSelection * | selection () const |
| return the selection shapes for this shapeManager | |
| virtual void | paint (QPainter &painter, const KoViewConverter &converter, bool forPrint) |
| Paint all shapes and their selection handles etc. | |
| KoShape * | shapeAt (const QPointF &position, KoFlake::ShapeSelection selection=KoFlake::ShapeOnTop, bool omitHiddenShapes=true) |
| Returns the shape located at a specific point in the document. | |
| QList< KoShape * > | shapesAt (const QRectF &rect, bool omitHiddenShapes=true) |
| Returns the shapes which intersects the specific rect in the document. | |
| void | update (QRectF &rect, const KoShape *shape=0, bool selectionHandles=false) |
| Request a repaint to be queued. | |
| void | notifyShapeChanged (KoShape *shape) |
| Update the tree for finding the shapes. | |
| void | suggestChangeTool (KoPointerEvent *event) |
| Switch to editing the shape that is at the position of the event. | |
| void | paintShape (KoShape *shape, QPainter &painter, const KoViewConverter &converter, bool forPrint) |
| Paint a shape. | |
| void | setPaintingStrategy (KoShapeManagerPaintingStrategy *strategy) |
| Set the strategy of the KoShapeManager. | |
There is one shape manager per view.
The selection in the different views can be different.
| KoShapeManager::KoShapeManager | ( | KoCanvasBase * | canvas, | |
| const QList< KoShape * > & | shapes | |||
| ) |
Constructor that takes a list of shapes, convenience version.
| shapes | the shapes to start out with, see also setShapes() | |
| canvas | the canvas this shape manager is working on. |
| void KoShapeManager::add | ( | KoShape * | shape | ) |
Add a KoShape to be displayed and managed by this manager.
This will trigger a repaint of the shape.
| shape | the shape to add |
| void KoShapeManager::notifyShapeChanged | ( | KoShape * | shape | ) |
Update the tree for finding the shapes.
This will remove the shape from the tree and will reinsert it again. The update to the tree will be posponed until it is needed so that successive calls will be merged into one.
| shape | the shape to updated its position in the tree. |
| void KoShapeManager::paint | ( | QPainter & | painter, | |
| const KoViewConverter & | converter, | |||
| bool | forPrint | |||
| ) | [virtual] |
Paint all shapes and their selection handles etc.
| painter | the painter to paint to. | |
| forPrint | if true, make sure only actual content is drawn and no decorations. | |
| converter | to convert between document and view coordinates. |
| void KoShapeManager::paintShape | ( | KoShape * | shape, | |
| QPainter & | painter, | |||
| const KoViewConverter & | converter, | |||
| bool | forPrint | |||
| ) |
Paint a shape.
| shape | the shape to paint | |
| painter | the painter to paint to. | |
| converter | to convert between document and view coordinates. | |
| forPrint | if true, make sure only actual content is drawn and no decorations. |
| void KoShapeManager::remove | ( | KoShape * | shape | ) |
| void KoShapeManager::setPaintingStrategy | ( | KoShapeManagerPaintingStrategy * | strategy | ) |
Set the strategy of the KoShapeManager.
This can be used to change the behaviour of the painting of the shapes.
| strategy | the new strategy. The given strategy has to be allocared on the stack and you the ownership will be taken by the shape manager. The shape manager will delete the last set strategy when you set a new one. |
| void KoShapeManager::setShapes | ( | const QList< KoShape * > & | shapes, | |
| bool | repaint = true | |||
| ) |
Remove all previously owned shapes and make the argument list the new shapes to be managed by this manager.
| shapes | the new shapes to manage. | |
| repaint | if true it will trigger a repaint of the shapes |
| KoShape * KoShapeManager::shapeAt | ( | const QPointF & | position, | |
| KoFlake::ShapeSelection | selection = KoFlake::ShapeOnTop, |
|||
| bool | omitHiddenShapes = true | |||
| ) |
Returns the shape located at a specific point in the document.
If more than one shape is located at the specific point, the given selection type controls which of them is returned.
| position | the position in the document coordinate system. | |
| selection | controls which shape is returned when more than one shape is at the specific point | |
| omitHiddenShapes | if true, only visible shapes are considered |
| QList< KoShape * > KoShapeManager::shapesAt | ( | const QRectF & | rect, | |
| bool | omitHiddenShapes = true | |||
| ) |
Returns the shapes which intersects the specific rect in the document.
| rect | the rectangle in the document coordinate system. | |
| omitHiddenShapes | if true, only visible shapes are considered |
| void KoShapeManager::suggestChangeTool | ( | KoPointerEvent * | event | ) |
Switch to editing the shape that is at the position of the event.
This method will check select a shape at the event position and switch to the default tool for that shape, or switch to the default tool if there is no shape at the position.
| event | the event that holds the point where to look for a shape. |
| void KoShapeManager::update | ( | QRectF & | rect, | |
| const KoShape * | shape = 0, |
|||
| bool | selectionHandles = false | |||
| ) |
Request a repaint to be queued.
The repaint will be restricted to the parameters rectangle, which is expected to be in points (the document coordinates system of KoShape) and it is expected to be normalized and based in the global coordinates, not any local coordinates.
This method will return immediately and only request a repaint. Successive calls will be merged into an appropriate repaint action.
| rect | the rectangle (in pt) to queue for repaint. | |
| shape | the shape that is going to be redrawn; only needed when selectionHandles=true | |
| selectionHandles | if true; find out if the shape is selected and repaint its selection handles at the same time. |
1.4.7