Krita Source Code Documentation
Loading...
Searching...
No Matches
SelectionInteractionStrategy Class Reference
+ Inheritance diagram for SelectionInteractionStrategy:

Public Member Functions

void cancelInteraction () override
 
void finishInteraction (Qt::KeyboardModifiers modifiers=QFlags< Qt::KeyboardModifier >()) override
 
void paint (QPainter &painter, const KoViewConverter &converter) override
 
 SelectionInteractionStrategy (KoToolBase *parent, const QPointF &clicked, bool useSnapToGrid)
 
- Public Member Functions inherited from KoShapeRubberSelectStrategy
KUndo2CommandcreateCommand () override
 
void handleMouseMove (const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
 
 KoShapeRubberSelectStrategy (KoToolBase *tool, const QPointF &clicked, bool useSnapToGrid=false)
 
- Public Member Functions inherited from KoInteractionStrategy
 KoInteractionStrategy (KoToolBase *parent)
 constructor
 
KoToolBasetool () const
 
virtual ~KoInteractionStrategy ()
 Destructor.
 

Additional Inherited Members

- Protected Types inherited from KoShapeRubberSelectStrategy
enum  SelectionMode { CrossingSelection , CoveringSelection }
 
- Protected Member Functions inherited from KoShapeRubberSelectStrategy
virtual SelectionMode currentMode () const
 
 KoShapeRubberSelectStrategy (KoShapeRubberSelectStrategyPrivate &)
 constructor
 
QRectF selectedRectangle () const
 
- Protected Member Functions inherited from KoInteractionStrategy
uint decorationThickness () const
 
uint grabSensitivity () const
 Convenience function to get the global grab sensitivity.
 
uint handleRadius () const
 Convenience function to get the global handle radius.
 
 KoInteractionStrategy (KoInteractionStrategyPrivate &)
 constructor
 
- Protected Attributes inherited from KoInteractionStrategy
KoInteractionStrategyPrivated_ptr
 

Detailed Description

Definition at line 136 of file DefaultTool.cpp.

Constructor & Destructor Documentation

◆ SelectionInteractionStrategy()

SelectionInteractionStrategy::SelectionInteractionStrategy ( KoToolBase * parent,
const QPointF & clicked,
bool useSnapToGrid )
inlineexplicit

Definition at line 139 of file DefaultTool.cpp.

140 : KoShapeRubberSelectStrategy(parent, clicked, useSnapToGrid)
141 {
142 }
KoShapeRubberSelectStrategy(KoToolBase *tool, const QPointF &clicked, bool useSnapToGrid=false)

Member Function Documentation

◆ cancelInteraction()

void SelectionInteractionStrategy::cancelInteraction ( )
inlineoverridevirtual

This method will undo frames based interactions by calling createCommand() and unexecuting that.

Reimplemented from KoInteractionStrategy.

Definition at line 148 of file DefaultTool.cpp.

149 {
150 tool()->canvas()->updateCanvas(selectedRectangle() | tool()->decorationsRect());
151 }
virtual void updateCanvas(const QRectF &rc)=0
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.

References KoToolBase::canvas(), KoShapeRubberSelectStrategy::selectedRectangle(), KoInteractionStrategy::tool(), and KoCanvasBase::updateCanvas().

◆ finishInteraction()

void SelectionInteractionStrategy::finishInteraction ( Qt::KeyboardModifiers modifiers = QFlags< Qt::KeyboardModifier >())
inlineoverridevirtual

Override to make final changes to the data on the end of an interaction.

Implements KoInteractionStrategy.

Definition at line 153 of file DefaultTool.cpp.

154 {
155 Q_UNUSED(modifiers);
156 DefaultTool *defaultTool = dynamic_cast<DefaultTool*>(tool());
158
159 KoSelection * selection = defaultTool->koSelection();
160
161 const bool useContainedMode = currentMode() == CoveringSelection;
162
163 QList<KoShape *> shapes =
164 defaultTool->shapeManager()->
165 shapesAt(selectedRectangle(), true, useContainedMode);
166
167 Q_FOREACH (KoShape * shape, shapes) {
168 if (!shape->isSelectable()) continue;
169
170 selection->select(shape);
171 }
172
173 tool()->canvas()->updateCanvas(selectedRectangle() | tool()->decorationsRect());
174 }
virtual KoSelection * koSelection() const
virtual KoShapeManager * shapeManager() const
void select(KoShape *shape)
virtual SelectionMode currentMode() const
bool isSelectable() const
Definition KoShape.cpp:837
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KoToolBase::canvas(), KoShapeRubberSelectStrategy::CoveringSelection, KoShapeRubberSelectStrategy::currentMode(), KoShape::isSelectable(), KIS_SAFE_ASSERT_RECOVER_RETURN, DefaultTool::koSelection(), KoSelection::select(), KoShapeRubberSelectStrategy::selectedRectangle(), DefaultTool::shapeManager(), KoInteractionStrategy::tool(), and KoCanvasBase::updateCanvas().

◆ paint()

void SelectionInteractionStrategy::paint ( QPainter & painter,
const KoViewConverter & converter )
inlineoverridevirtual

Reimplement this if the action needs to draw a "blob" on the canvas; that is, a transient decoration like a rubber band.

Reimplemented from KoShapeRubberSelectStrategy.

Definition at line 144 of file DefaultTool.cpp.

144 {
145 KoShapeRubberSelectStrategy::paint(painter, converter);
146 }
void paint(QPainter &painter, const KoViewConverter &converter) override

References KoShapeRubberSelectStrategy::paint().


The documentation for this class was generated from the following file: