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 130 of file DefaultTool.cpp.

Constructor & Destructor Documentation

◆ SelectionInteractionStrategy()

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

Definition at line 133 of file DefaultTool.cpp.

134 : KoShapeRubberSelectStrategy(parent, clicked, useSnapToGrid)
135 {
136 }
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 142 of file DefaultTool.cpp.

143 {
144 tool()->canvas()->updateCanvas(selectedRectangle() | tool()->decorationsRect());
145 }
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 147 of file DefaultTool.cpp.

148 {
149 Q_UNUSED(modifiers);
150 DefaultTool *defaultTool = dynamic_cast<DefaultTool*>(tool());
152
153 KoSelection * selection = defaultTool->koSelection();
154
155 const bool useContainedMode = currentMode() == CoveringSelection;
156
157 QList<KoShape *> shapes =
158 defaultTool->shapeManager()->
159 shapesAt(selectedRectangle(), true, useContainedMode);
160
161 Q_FOREACH (KoShape * shape, shapes) {
162 if (!shape->isSelectable()) continue;
163
164 selection->select(shape);
165 }
166
167 tool()->canvas()->updateCanvas(selectedRectangle() | tool()->decorationsRect());
168 }
virtual KoSelection * koSelection() const
virtual KoShapeManager * shapeManager() const
void select(KoShape *shape)
virtual SelectionMode currentMode() const
bool isSelectable() const
Definition KoShape.cpp:1014
#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 138 of file DefaultTool.cpp.

138 {
139 KoShapeRubberSelectStrategy::paint(painter, converter);
140 }
void paint(QPainter &painter, const KoViewConverter &converter) override

References KoShapeRubberSelectStrategy::paint().


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