Krita Source Code Documentation
Loading...
Searching...
No Matches
KoPathPointRubberSelectStrategy.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
3 * SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
10
11#include "KoCanvasBase.h"
12#include "KoPathTool.h"
13#include "KoPathToolSelection.h"
14
16 : KoShapeRubberSelectStrategy(tool, clicked)
17 , m_tool(tool)
18{
19}
20
21void KoPathPointRubberSelectStrategy::handleMouseMove(const QPointF &p, Qt::KeyboardModifiers modifiers)
22{
23 KoPathToolSelection * selection = dynamic_cast<KoPathToolSelection*>(m_tool->selection());
24 if (selection && !(modifiers & Qt::ShiftModifier)) {
25 selection->clear();
26 }
27
29}
30
31void KoPathPointRubberSelectStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
32{
34 KoPathToolSelection * selection = dynamic_cast<KoPathToolSelection*>(m_tool->selection());
35 if (!selection) {
36 return;
37 }
38
39 const QRectF oldDirtyRect = d->selectedRect().normalized() | m_tool->decorationsRect();
40 selection->selectPoints(d->selectedRect(), !(modifiers & Qt::ShiftModifier));
41 m_tool->canvas()->updateCanvas(oldDirtyRect |
42 d->selectedRect().normalized() |
44}
45
const Params2D p
virtual void updateCanvas(const QRectF &rc)=0
KoPathTool * m_tool
pointer to the path tool
void handleMouseMove(const QPointF &p, Qt::KeyboardModifiers modifiers) override
void finishInteraction(Qt::KeyboardModifiers modifiers) override
KoPathPointRubberSelectStrategy(KoPathTool *tool, const QPointF &clicked)
Handle the selection of points.
void clear()
Clear the selection.
void selectPoints(const QRectF &rect, bool clearSelection)
Select points in rect.
QRectF decorationsRect() const override
KoToolSelection * selection() override
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.