Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgMoveTextCommand.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Alvin <alvin@alvinhc.com>
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
8
9#include <klocalizedstring.h>
10
11#include "KoSvgTextShape.h"
12#include "kis_command_ids.h"
14
16 const QPointF &newPosition,
17 const QPointF &oldPosition,
18 KUndo2Command *parent)
19 : KUndo2Command(parent)
20 , m_shape(shape)
21 , m_newPosition(newPosition)
22 , m_oldPosition(oldPosition)
23{
24 setText(kundo2_i18n("Move text"));
25}
26
27static void moveShape(KoSvgTextShape *shape, const QPointF &position)
28{
29 KoShapeBulkActionLock lock(shape);
30 shape->setAbsolutePosition(position);
32}
33
38
43
48
50{
51 const SvgMoveTextCommand *other = dynamic_cast<const SvgMoveTextCommand *>(otherCommand);
52
53 if (!other || other->m_shape != m_shape) {
54 return false;
55 }
56
58
59 return true;
60}
static void moveShape(KoSvgTextShape *shape, const QPointF &position)
void setText(const KUndo2MagicString &text)
static void bulkShapesUpdate(const UpdatesList &updates)
void setAbsolutePosition(const QPointF &newPosition, KoFlake::AnchorPosition anchor=KoFlake::Center)
Definition KoShape.cpp:588
int id() const override
SvgMoveTextCommand(KoSvgTextShape *shape, const QPointF &newPosition, const QPointF &oldPosition, KUndo2Command *parent=nullptr)
KoSvgTextShape * m_shape
bool mergeWith(const KUndo2Command *other) override
KUndo2MagicString kundo2_i18n(const char *text)