Krita Source Code Documentation
Loading...
Searching...
No Matches
ShapeMeshGradientEditStrategy.cpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2020 Sharaf Zaman <sharafzaz121@gmail.com>
3
*
4
* SPDX-License-Identifier: GPL-2.0-or-later
5
*/
6
7
#include "
ShapeMeshGradientEditStrategy.h
"
8
9
#include <
KoToolBase.h
>
10
#include <
KoCanvasBase.h
>
11
#include <
kundo2command.h
>
12
#include <
kis_command_utils.h
>
13
14
struct
ShapeMeshGradientEditStrategy::Private
{
15
Private
(
const
QPointF&
start
,
KoShape
*shape,
KoFlake::FillVariant
fillVariant)
16
:
start
(
start
)
17
,
handles
(fillVariant, shape)
18
{
19
}
20
21
// TODO: for snapping..
22
QPointF
start
;
23
KoShapeMeshGradientHandles::Handle
startHandle
;
24
KoShapeMeshGradientHandles
handles
;
25
QScopedPointer<KUndo2Command>
intermediateCommand
;
26
};
27
28
ShapeMeshGradientEditStrategy::ShapeMeshGradientEditStrategy
(
KoToolBase
*tool,
29
KoFlake::FillVariant
fillVariant,
30
KoShape
*shape,
31
KoShapeMeshGradientHandles::Handle
startHandle,
32
const
QPointF &clicked)
33
:
KoInteractionStrategy
(tool)
34
, m_d(new
Private
(clicked, shape, fillVariant))
35
{
36
m_d
->startHandle = startHandle;
37
}
38
39
ShapeMeshGradientEditStrategy::~ShapeMeshGradientEditStrategy
()
40
{
41
}
42
43
void
ShapeMeshGradientEditStrategy::handleMouseMove
(
const
QPointF &mouseLocation,
44
Qt::KeyboardModifiers modifiers)
45
{
46
Q_UNUSED(modifiers);
47
48
49
KisCommandUtils::redoAndMergeIntoAccumulatingCommand
(
50
m_d
->handles.moveGradientHandle(
m_d
->startHandle, mouseLocation),
51
m_d
->intermediateCommand);
52
}
53
54
KUndo2Command
*
ShapeMeshGradientEditStrategy::createCommand
()
55
{
56
return
m_d
->intermediateCommand ?
57
new
KisCommandUtils::SkipFirstRedoWrapper
(
m_d
->intermediateCommand.take()) :
58
nullptr
;
59
}
60
61
void
ShapeMeshGradientEditStrategy::finishInteraction
(Qt::KeyboardModifiers modifiers)
62
{
63
Q_UNUSED(modifiers)
64
}
KoCanvasBase.h
KoToolBase.h
ShapeMeshGradientEditStrategy.h
KUndo2Command
Definition
kundo2stack.h:87
KoInteractionStrategy
Definition
KoInteractionStrategy.h:38
KoShapeMeshGradientHandles
Definition
KoShapeMeshGradientHandles.h:18
KoShape
Definition
KoShape.h:92
KoToolBase
Definition
KoToolBase.h:57
ShapeMeshGradientEditStrategy::createCommand
KUndo2Command * createCommand() override
Definition
ShapeMeshGradientEditStrategy.cpp:54
ShapeMeshGradientEditStrategy::m_d
QScopedPointer< Private > m_d
Definition
ShapeMeshGradientEditStrategy.h:33
ShapeMeshGradientEditStrategy::~ShapeMeshGradientEditStrategy
~ShapeMeshGradientEditStrategy()
Definition
ShapeMeshGradientEditStrategy.cpp:39
ShapeMeshGradientEditStrategy::ShapeMeshGradientEditStrategy
ShapeMeshGradientEditStrategy(KoToolBase *tool, KoFlake::FillVariant fillVariant, KoShape *shape, KoShapeMeshGradientHandles::Handle startHandle, const QPointF &clicked)
Definition
ShapeMeshGradientEditStrategy.cpp:28
ShapeMeshGradientEditStrategy::finishInteraction
void finishInteraction(Qt::KeyboardModifiers modifiers) override
Definition
ShapeMeshGradientEditStrategy.cpp:61
ShapeMeshGradientEditStrategy::handleMouseMove
void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
Definition
ShapeMeshGradientEditStrategy.cpp:43
kis_command_utils.h
kundo2command.h
KisCommandUtils::redoAndMergeIntoAccumulatingCommand
void redoAndMergeIntoAccumulatingCommand(KUndo2Command *cmd, QScopedPointer< KUndo2Command > &accumulatingCommand)
Definition
kis_command_utils.cpp:201
KoFlake::FillVariant
FillVariant
Definition
KoFlake.h:28
Private
Definition
SvgTransformParser.cpp:20
KisCommandUtils::SkipFirstRedoWrapper
Definition
kis_command_utils.h:68
KoShapeMeshGradientHandles::Handle
Definition
KoShapeMeshGradientHandles.h:20
ShapeMeshGradientEditStrategy::Private
Definition
ShapeMeshGradientEditStrategy.cpp:14
ShapeMeshGradientEditStrategy::Private::start
QPointF start
Definition
ShapeMeshGradientEditStrategy.cpp:22
ShapeMeshGradientEditStrategy::Private::intermediateCommand
QScopedPointer< KUndo2Command > intermediateCommand
Definition
ShapeMeshGradientEditStrategy.cpp:25
ShapeMeshGradientEditStrategy::Private::handles
KoShapeMeshGradientHandles handles
Definition
ShapeMeshGradientEditStrategy.cpp:24
ShapeMeshGradientEditStrategy::Private::startHandle
KoShapeMeshGradientHandles::Handle startHandle
Definition
ShapeMeshGradientEditStrategy.cpp:23
ShapeMeshGradientEditStrategy::Private::Private
Private(const QPointF &start, KoShape *shape, KoFlake::FillVariant fillVariant)
Definition
ShapeMeshGradientEditStrategy.cpp:15
plugins
tools
defaulttool
defaulttool
ShapeMeshGradientEditStrategy.cpp
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52