[graphics/krita] /: Revert "510834-Selection-Move-Tool"

Dmitry Kazakov null at kde.org
Thu Jun 25 12:03:06 BST 2026


Git commit 2bd9710f0c415ae5558df26eb89026134c8608a1 by Dmitry Kazakov, on behalf of Ricky Ringler.
Committed on 25/06/2026 at 11:02.
Pushed by dkazakov into branch 'master'.

Revert "510834-Selection-Move-Tool"

This reverts commit 8df2664afc0190076fba56d0bb7d173f26f68eb1.

The feature causes bug 520941 and also a set of deadlocks
when using SAP while doing a move action during the selection
move stroke. I will restart is as a new MR for further fixes.

We should also track the documentation MR:
https://invent.kde.org/documentation/docs-krita-org/-/merge_requests/376

If the fix will not get in time for the next major release,
it will also have to be reverted.


CC:kimageshop at kde.org

M  +8    -8    libs/flake/KoToolBase.h
M  +0    -1    libs/ui/CMakeLists.txt
M  +0    -4    libs/ui/tests/CMakeLists.txt
M  +0    -21   libs/ui/tool/kis_selection_tool_config_widget_helper.cpp
M  +0    -2    libs/ui/tool/kis_selection_tool_config_widget_helper.h
M  +40   -243  libs/ui/tool/kis_tool_select_base.h
M  +0    -23   libs/ui/widgets/kis_selection_options.cc
M  +0    -3    libs/ui/widgets/kis_selection_options.h
M  +1    -0    plugins/tools/basictools/CMakeLists.txt
R  +1    -1    plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp [from: libs/ui/tool/strokes/move_selection_stroke_strategy.cpp - 098% similarity]
R  +2    -3    plugins/tools/basictools/strokes/move_selection_stroke_strategy.h [from: libs/ui/tool/strokes/move_selection_stroke_strategy.h - 089% similarity]
M  +8    -1    plugins/tools/basictools/tests/CMakeLists.txt
R  +0    -0    plugins/tools/basictools/tests/move_selection_stroke_test.cpp [from: libs/ui/tests/move_selection_stroke_test.cpp - 100% similarity]
R  +0    -0    plugins/tools/basictools/tests/move_selection_stroke_test.h [from: libs/ui/tests/move_selection_stroke_test.h - 100% similarity]

https://invent.kde.org/graphics/krita/-/commit/2bd9710f0c415ae5558df26eb89026134c8608a1

diff --git a/libs/flake/KoToolBase.h b/libs/flake/KoToolBase.h
index b2b38aa87d2..d5e664404dd 100644
--- a/libs/flake/KoToolBase.h
+++ b/libs/flake/KoToolBase.h
@@ -164,7 +164,7 @@ public:
 
     /**
      * @brief explicitUserStrokeEndRequest is called by the input manager
-     *        when the user presses the Enter key or any equivalent key. This callback
+     *        when the user presses Enter key or any equivalent. This callback
      *        comes before requestStrokeEnd(), which comes from a different source.
      */
     virtual void explicitUserStrokeEndRequest();
@@ -362,8 +362,8 @@ public Q_SLOTS:
 
     /**
      * Called when the user requested undo while the stroke is
-     * active. If your tool supports undoing, override this method
-     * and implement the desired effects there.
+     * active. If you tool supports undo of the part of its actions,
+     * override this method and do the needed work there.
      *
      * NOTE: Default implementation forwards this request to
      *       requestStrokeCancellation() method, so that the stroke
@@ -379,16 +379,16 @@ public Q_SLOTS:
     virtual void requestRedoDuringStroke();
 
     /**
-     * Called when the user requests cancellation of the current
-     * stroke. If your tool supports cancelling, override this method
-     * and implement the desired effects there.
+     * Called when the user requested the cancellation of the current
+     * stroke. If you tool supports cancelling, override this method
+     * and do the needed work there
      */
     virtual void requestStrokeCancellation();
 
     /**
      * Called when the image decided that the stroke should better be
-     * ended. If your tool supports long strokes, override this method
-     * and implement the desired effects there.
+     * ended. If you tool supports long strokes, override this method
+     * and do the needed work there
      */
     virtual void requestStrokeEnd();
 
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index ab7863d63e2..a2e85744295 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -231,7 +231,6 @@ set(kritaui_LIB_SRCS
     tool/strokes/KisMaskingBrushRenderer.cpp
     tool/strokes/KisMaskingBrushCompositeOpFactory.cpp
     tool/strokes/move_stroke_strategy.cpp
-    tool/strokes/move_selection_stroke_strategy.cpp
     tool/strokes/KisNodeSelectionRecipe.cpp
     tool/KisSelectionToolFactoryBase.cpp
     tool/KisToolPaintFactoryBase.cpp
diff --git a/libs/ui/tests/CMakeLists.txt b/libs/ui/tests/CMakeLists.txt
index c8c98f878ae..415e1c0851c 100644
--- a/libs/ui/tests/CMakeLists.txt
+++ b/libs/ui/tests/CMakeLists.txt
@@ -104,10 +104,6 @@ kis_add_test( kis_dummies_facade_test.cpp kis_dummies_facade_base_test.cpp ../..
     LINK_LIBRARIES kritaui kritatestsdk
     )
 
-kis_add_test(move_selection_stroke_test.cpp  ../../../sdk/tests/stroke_testing_utils.cpp
-        TEST_NAME MoveSelectionStrokeTest
-        LINK_LIBRARIES kritadefaulttools_static kritabasicflakes kritaui kritatestsdk
-)
 
 ##### Tests that currently fail and should be fixed #####
 
diff --git a/libs/ui/tool/kis_selection_tool_config_widget_helper.cpp b/libs/ui/tool/kis_selection_tool_config_widget_helper.cpp
index d727651bc9e..9365bb9bde7 100644
--- a/libs/ui/tool/kis_selection_tool_config_widget_helper.cpp
+++ b/libs/ui/tool/kis_selection_tool_config_widget_helper.cpp
@@ -34,10 +34,6 @@ void KisSelectionToolConfigWidgetHelper::createOptionWidget(
             &KisSelectionOptions::actionChanged,
             this,
             &KisSelectionToolConfigWidgetHelper::slotWidgetActionChanged);
-    connect(m_optionsWidget,
-            &KisSelectionOptions::moveSelectedContentChanged,
-            this,
-            &KisSelectionToolConfigWidgetHelper::slotWidgetMoveSelectedContentChanged);
     connect(m_optionsWidget, &KisSelectionOptions::antiAliasSelectionChanged,
             this, &KisSelectionToolConfigWidgetHelper::slotWidgetAntiAliasChanged);
     connect(m_optionsWidget,
@@ -81,14 +77,6 @@ SelectionAction KisSelectionToolConfigWidgetHelper::selectionAction() const
     return m_optionsWidget->action();
 }
 
-bool KisSelectionToolConfigWidgetHelper::moveSelectedContent() const
-{
-    if (!m_optionsWidget) {
-        return true;
-    }
-    return m_optionsWidget->moveSelectedContent();
-}
-
 bool KisSelectionToolConfigWidgetHelper::antiAliasSelection() const
 {
     if (!m_optionsWidget) {
@@ -160,12 +148,6 @@ void KisSelectionToolConfigWidgetHelper::slotWidgetActionChanged(
     Q_EMIT selectionActionChanged(action);
 }
 
-void KisSelectionToolConfigWidgetHelper::slotWidgetMoveSelectedContentChanged(bool value)
-{
-    KConfigGroup cfg = KSharedConfig::openConfig()->group(m_configGroupForTool);
-    cfg.writeEntry("moveSelectedContent", value);
-}
-
 void KisSelectionToolConfigWidgetHelper::slotWidgetAntiAliasChanged(bool value)
 {
     KConfigGroup cfg = KSharedConfig::openConfig()->group(m_configGroupForTool);
@@ -278,8 +260,6 @@ void KisSelectionToolConfigWidgetHelper::reloadExactToolConfig()
 
     KConfigGroup cfgToolSpecific =
         KSharedConfig::openConfig()->group(m_configGroupForTool);
-    const bool moveSelectedContent =
-        cfgToolSpecific.readEntry("moveSelectedContent", false);
     const bool antiAliasSelection =
         cfgToolSpecific.readEntry("antiAliasSelection", true);
     const int growSelection = cfgToolSpecific.readEntry("growSelection", 0);
@@ -310,7 +290,6 @@ void KisSelectionToolConfigWidgetHelper::reloadExactToolConfig()
     }
 
     KisSignalsBlocker b(m_optionsWidget);
-    m_optionsWidget->setMoveSelectedContent(moveSelectedContent);
     m_optionsWidget->setAntiAliasSelection(antiAliasSelection);
     m_optionsWidget->setGrowSelection(growSelection);
     m_optionsWidget->setStopGrowingAtDarkestPixel(stopGrowingAtDarkestPixel);
diff --git a/libs/ui/tool/kis_selection_tool_config_widget_helper.h b/libs/ui/tool/kis_selection_tool_config_widget_helper.h
index 2783211d848..b41eaac9ce3 100644
--- a/libs/ui/tool/kis_selection_tool_config_widget_helper.h
+++ b/libs/ui/tool/kis_selection_tool_config_widget_helper.h
@@ -29,7 +29,6 @@ public:
 
     SelectionMode selectionMode() const;
     SelectionAction selectionAction() const;
-    bool moveSelectedContent() const;
     bool antiAliasSelection() const;
     int growSelection() const;
     bool stopGrowingAtDarkestPixel() const;
@@ -49,7 +48,6 @@ public Q_SLOTS:
 
     void slotWidgetModeChanged(SelectionMode mode);
     void slotWidgetActionChanged(SelectionAction action);
-    void slotWidgetMoveSelectedContentChanged(bool value);
     void slotWidgetAntiAliasChanged(bool value);
     void slotWidgetGrowChanged(int value);
     void slotWidgetStopGrowingAtDarkestPixelChanged(bool value);
diff --git a/libs/ui/tool/kis_tool_select_base.h b/libs/ui/tool/kis_tool_select_base.h
index 116429f08e2..b21733a124c 100644
--- a/libs/ui/tool/kis_tool_select_base.h
+++ b/libs/ui/tool/kis_tool_select_base.h
@@ -18,7 +18,6 @@
 #include "kis_selection_manager.h"
 #include "kis_selection_modifier_mapper.h"
 #include "strokes/move_stroke_strategy.h"
-#include "strokes/move_selection_stroke_strategy.h"
 #include "kis_image.h"
 #include "kis_cursor.h"
 #include "kis_action_manager.h"
@@ -88,14 +87,6 @@ public:
         KisSelectionModifierMapper::instance();
     }
 
-    enum CursorHit
-    {
-        CursorHit_None,
-        CursorHit_Border,
-        CursorHit_Inside,
-        CursorHit_Outside
-    };
-
     enum SampleLayersMode
     {
         SampleAllLayers,
@@ -156,7 +147,6 @@ public:
 
     void deactivate() override
     {
-        commitMoveSelectionStroke();
         BaseClass::deactivate();
         m_modeConnections.clear();
     }
@@ -200,11 +190,6 @@ public:
         return alternateSelectionAction();
     }
 
-    bool moveSelectedContent() const
-    {
-        return m_widgetHelper.moveSelectedContent();
-    }
-
     bool antiAliasSelection() const
     {
         return m_widgetHelper.antiAliasSelection();
@@ -293,39 +278,6 @@ public:
         endPrimaryAction(event);
     }
 
-    void explicitUserStrokeEndRequest() override
-    {
-        commitMoveSelectionStroke();
-    }
-
-    void requestStrokeCancellation() override
-    {
-        cancelMoveSelectionStroke();
-    }
-
-    void cancelMoveSelectionStroke() {
-        commitMoveSelectionStrokeImpl(true);
-    }
-
-    void commitMoveSelectionStroke() {
-        commitMoveSelectionStrokeImpl(false);
-    }
-
-    void commitMoveSelectionStrokeImpl(bool cancel) {
-        if (m_moveStrokeId && isMovingContent()) {
-            if (!cancel) {
-                this->image()->endStroke(m_moveStrokeId);
-            } else {
-                this->image()->cancelStroke(m_moveStrokeId);
-            }
-            m_moveStrokeId.clear();
-            m_accumulatedOffset = QPoint();
-            m_dragStartOffset = QPoint();
-            this->endMoveContentInteraction();
-            return;
-        }
-    }
-
     KisNodeSP locateSelectionMaskUnderCursor(const QPointF &pos, Qt::KeyboardModifiers modifiers) {
         if (modifiers != Qt::NoModifier) return 0;
 
@@ -368,8 +320,8 @@ public:
         if (key == Qt::Key_Alt || event->modifiers().testFlag(Qt::AltModifier)) {
             m_currentModifiers.setFlag(Qt::AltModifier);
         }
-
-        // Avoid changing the cursor if the user is interacting
+        
+        // Avoid changing the selection mode and cursor if the user is interacting
         if (isSelecting()) {
             BaseClass::keyPressEvent(event);
             return;
@@ -379,7 +331,7 @@ public:
         }
 
         setAlternateSelectionAction(KisSelectionModifierMapper::map(m_currentModifiers));
-        updateCursor();
+        this->resetCursorStyle();
     }
 
     void keyReleaseEvent(QKeyEvent *event) override
@@ -409,9 +361,13 @@ public:
 
         setAlternateSelectionAction(KisSelectionModifierMapper::map(m_currentModifiers));
         if (m_currentModifiers == Qt::NoModifier) {
-            updateCursor();
-        }
-        else {
+            KisNodeSP selectionMask = locateSelectionMaskUnderCursor(m_currentPos, m_currentModifiers);
+            if (selectionMask) {
+                this->useCursor(KisCursor::moveSelectionCursor());
+            } else {
+                this->resetCursorStyle();
+            }
+        } else {
             this->resetCursorStyle();
         }
     }
@@ -419,105 +375,45 @@ public:
     void mouseMoveEvent(KoPointerEvent *event) override
     {
         m_currentPos = this->convertToPixelCoord(event->point);
-        m_currentModifiers = event->modifiers();
 
-        updateCursor();
-        BaseClass::mouseMoveEvent(event);
-    }
-
-    CursorHit checkCursorHit(const QPointF &pos, Qt::KeyboardModifiers modifiers) const
-    {
-        KisCanvas2 *canvas = dynamic_cast<KisCanvas2*>(this->canvas());
-        KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(canvas, CursorHit_Outside);
-        KisSelectionSP selection = canvas->viewManager()->selection();
-
-        if (!selection || !selection->outlineCacheValid()) {
-            return CursorHit_Outside;
+        if (isSelecting()) {
+            BaseClass::mouseMoveEvent(event);
+            return;
         }
-
-        const QPainterPath selectionPath = selection->outlineCache();
-
-        if (modifiers == Qt::NoModifier) {
-            const qreal handleRadius = qreal(this->handleRadius()) / canvas->coordinatesConverter()->effectiveZoom();
-
-            QPainterPath samplePath;
-            samplePath.addEllipse(pos, handleRadius, handleRadius);
-
-            if (selectionPath.intersects(samplePath) && !selectionPath.contains(samplePath)) {
-                    return CursorHit_Border;
-                }
+        if (isMovingSelection()) {
+            return;
         }
 
-        if (selectionPath.contains(pos)) {
-            return CursorHit_Inside;
+        KisNodeSP selectionMask = locateSelectionMaskUnderCursor(m_currentPos, event->modifiers());
+        if (selectionMask) {
+            this->useCursor(KisCursor::moveSelectionCursor());
+        } else {
+            setAlternateSelectionAction(KisSelectionModifierMapper::map(m_currentModifiers));
+            this->resetCursorStyle();
         }
-
-        return CursorHit_Outside;
     }
 
-    inline bool canBeginNewAction(KoPointerEvent *event, const QPointF &pos, CursorHit hit)
+    void beginPrimaryAction(KoPointerEvent *event) override
     {
-        /* Prevent interrupting while selecting a region */
         if (isSelecting()) {
             BaseClass::beginPrimaryAction(event);
-            return false;
-        }
-
-        /* Prevent interrupting while moving */
-        if (isMovingContent()) {
-            /* We must update the offsets here, so the offset is sane later */
-            m_dragStartPos = pos;
-            m_dragStartOffset = m_accumulatedOffset;
-            /* User clicked outside? Commit changes and start a new stroke */
-            /* This eliminates extra keystrokes to start a new transaction */
-            if (hit == CursorHit_Outside) {
-                commitMoveSelectionStroke();
-                BaseClass::beginPrimaryAction(event);
-                return false;
-            }
+            return;
         }
-
-        return true;
-    }
-
-    void beginPrimaryAction(KoPointerEvent *event) override
-    {
-        const QPointF pos = this->convertToPixelCoord(event->point);
-        const CursorHit hit = checkCursorHit(pos, event->modifiers());
-
-        if (!canBeginNewAction(event, pos, hit)) {
+        if (isMovingSelection()) {
             return;
         }
 
+        const QPointF pos = this->convertToPixelCoord(event->point);
         KisCanvas2* canvas = dynamic_cast<KisCanvas2*>(this->canvas());
         KIS_SAFE_ASSERT_RECOVER_RETURN(canvas);
 
-        if (hit == CursorHit_Inside && this->moveSelectedContent()) {
-            KisSelectionSP selection = canvas->viewManager()->selection();
-            KisPaintLayerSP layer = dynamic_cast<KisPaintLayer*>(this->currentNode().data());
-            if (this->beginMoveContentInteraction() && selection && layer) {
-                KisStrokeStrategy *strategy =
-                    new MoveSelectionStrokeStrategy(layer, selection, this->image().data(), this->image().data());
-                initializeStrokeAttributes(pos, strategy, true);
-                updateCursor();
-            }
-            return;
-        }
-
-        if (m_currentInteraction == Interaction_MoveContent &&
-            (hit == CursorHit_Inside || hit == CursorHit_Border)) {
-            // we shouldn't pass the control to the parent tool
-            // when we have the already started the move content action
-            return;
-        }
-
         KisNodeSP selectionMask = locateSelectionMaskUnderCursor(pos, event->modifiers());
         if (selectionMask) {
             if (this->beginMoveSelectionInteraction()) {
-                KisStrokeStrategy *strategy =
-                    new MoveStrokeStrategy({selectionMask}, this->image().data(), this->image().data());
-                initializeStrokeAttributes(pos, strategy, true);
-                updateCursor();
+                KisStrokeStrategy *strategy = new MoveStrokeStrategy({selectionMask}, this->image().data(), this->image().data());
+                m_moveStrokeId = this->image()->startStroke(strategy);
+                m_dragStartPos = pos;
+                m_didMove = true;
                 return;
             }
         }
@@ -528,26 +424,19 @@ public:
 
     void continuePrimaryAction(KoPointerEvent *event) override
     {
-        if (isMovingSelection() || isMovingContent()) {
+        if (isMovingSelection()) {
             const QPointF pos = this->convertToPixelCoord(event->point);
-            const QPoint delta = (pos - m_dragStartPos).toPoint();
-            const QPoint offset = m_dragStartOffset + delta;
-            m_accumulatedOffset = offset;
+            const QPoint offset((pos - m_dragStartPos).toPoint());
+
             this->image()->addJob(m_moveStrokeId, new MoveStrokeStrategy::Data(offset));
             return;
-    }
+        }
 
         BaseClass::continuePrimaryAction(event);
     }
 
     void endPrimaryAction(KoPointerEvent *event) override
     {
-        if (isMovingContent()) {
-            const QPointF pos = this->convertToPixelCoord(event->point);
-            const QPoint delta = (pos - m_dragStartPos).toPoint();
-            m_accumulatedOffset = m_dragStartOffset + delta;
-            return;
-        }
         if (isMovingSelection()) {
             this->image()->endStroke(m_moveStrokeId);
             m_moveStrokeId.clear();
@@ -583,14 +472,6 @@ public:
         return nullptr;
     }
 
-    inline void initializeStrokeAttributes(const QPointF &pos, KisStrokeStrategy *strategy, bool moved) {
-        m_moveStrokeId = this->image()->startStroke(strategy);
-        m_dragStartPos = pos;
-        m_didMove = moved;
-        m_accumulatedOffset = QPoint();
-        m_dragStartOffset = QPoint();
-    }
-
     bool beginMoveSelectionInteraction() {
         if (m_currentInteraction != Interaction_None) {
             return false;
@@ -608,23 +489,6 @@ public:
         return true;
     }
 
-    bool beginMoveContentInteraction() {
-        if (m_currentInteraction != Interaction_None) {
-            return false;
-        }
-        m_currentInteraction = Interaction_MoveContent;
-        return true;
-    }
-
-    bool endMoveContentInteraction() {
-        if (!isMovingContent()) {
-            return false;
-        }
-        m_currentInteraction = Interaction_None;
-        updateCursorDelayed();
-        return true;
-    }
-
     bool beginSelectInteraction() {
         if (m_currentInteraction != Interaction_None) {
             return false;
@@ -646,82 +510,22 @@ public:
         return m_currentInteraction == Interaction_MoveSelection;
     }
 
-    bool isMovingContent() const {
-        return m_currentInteraction == Interaction_MoveContent;
-    }
-
     bool isSelecting() const {
         return m_currentInteraction == Interaction_Select;
     }
 
-    void updateCursor()
-    {
-
-        const Interaction interaction = currentInteraction();
-        const CursorHit hit = checkCursorHit(m_currentPos, m_currentModifiers);
-
-        switch (interaction)
-        {
-            case Interaction_MoveContent:
-                switch (hit)
-                {
-                    case CursorHit_Border:
-                        this->useCursor(KisCursor::moveCursor());
-                        break;
-                    case CursorHit_Inside:
-                        this->useCursor(KisCursor::moveCursor());
-                        break;
-                    case CursorHit_Outside:
-                        this->resetCursorStyle();
-                        break;
-                    case CursorHit_None:
-                    default:
-                        break;
-                }
-                break;
-            case Interaction_MoveSelection:
-                switch (hit)
-                {
-                    case CursorHit_Border:
-                        this->useCursor(KisCursor::moveSelectionCursor());
-                        break;
-                    case CursorHit_Inside:
-                        this->resetCursorStyle();
-                        break;
-                    case CursorHit_Outside:
-                        this->resetCursorStyle();
-                        break;
-                    case CursorHit_None:
-                    default:
-                        break;
-                }
-                break;
-            case Interaction_Select:
-                this->useCursor(KisCursor::moveCursor());
-                break;
-            case Interaction_None:
-                if (hit == CursorHit_Border){
-                    this->useCursor(KisCursor::moveSelectionCursor());
-                }
-                else if (hit == CursorHit_Inside && this->moveSelectedContent()) {
-                    this->useCursor(KisCursor::moveCursor());
-                } else {
-                    this->resetCursorStyle();
-                }
-                break;
-            default:
-                this->resetCursorStyle();
-                break;
-        }
-    }
-
     void updateCursorDelayed() {
         setAlternateSelectionAction(KisSelectionModifierMapper::map(m_currentModifiers));
         QTimer::singleShot(100, Qt::CoarseTimer,
             this,
             [this]()
             {
-                updateCursor();
+                KisNodeSP selectionMask = locateSelectionMaskUnderCursor(m_currentPos, m_currentModifiers);
+                if (selectionMask) {
+                    this->useCursor(KisCursor::moveSelectionCursor());
+                } else {
+                    this->resetCursorStyle();
+                }
             }
         );
     }
@@ -744,22 +548,15 @@ private:
     {
         Interaction_None,
         Interaction_Select,
-        Interaction_MoveSelection,
-        Interaction_MoveContent
+        Interaction_MoveSelection
     };
 
     Interaction m_currentInteraction{Interaction_None};
 
-    Interaction currentInteraction() const {
-        return m_currentInteraction;
-    }
-
     Qt::KeyboardModifiers m_currentModifiers;
 
     QPointF m_dragStartPos;
     QPointF m_currentPos;
-    QPoint m_accumulatedOffset;
-    QPoint m_dragStartOffset;
     KisStrokeId m_moveStrokeId;
     bool m_didMove = false;
 
diff --git a/libs/ui/widgets/kis_selection_options.cc b/libs/ui/widgets/kis_selection_options.cc
index 63e152f87be..3eafa1a8540 100644
--- a/libs/ui/widgets/kis_selection_options.cc
+++ b/libs/ui/widgets/kis_selection_options.cc
@@ -28,7 +28,6 @@ public:
     KisSelectionOptions *q;
     KisOptionButtonStrip *optionButtonStripMode{nullptr};
     KisOptionButtonStrip *optionButtonStripAction{nullptr};
-    QCheckBox *checkBoxMoveSelectedContent{nullptr};
     QCheckBox *checkBoxAntiAliasSelection{nullptr};
     KisSliderSpinBox *sliderGrowSelection{nullptr};
     QToolButton *buttonStopGrowingAtDarkestPixel {nullptr};
@@ -185,10 +184,6 @@ KisSelectionOptions::KisSelectionOptions(QWidget *parent)
         m_d->checkBoxSelectionActionsPanel->setCheckState(Qt::CheckState::Unchecked);
     }
 
-    m_d->checkBoxMoveSelectedContent = new QCheckBox(
-        i18nc("The move-selected-content checkbox in selection tool options",
-            "Move Selected Content"));
-
     m_d->checkBoxAntiAliasSelection = new QCheckBox(
         i18nc("The anti-alias checkbox in fill tool options", "Anti-aliasing"));
     KisOptionCollectionWidget *containerGrowSelection = new KisOptionCollectionWidget;
@@ -245,9 +240,6 @@ KisSelectionOptions::KisSelectionOptions(QWidget *parent)
     m_d->optionButtonStripAction->button(4)->setToolTip(
         i18nc("@info:tooltip", "Symmetric Difference"));
 
-    m_d->checkBoxMoveSelectedContent->setToolTip(
-        i18nc("@info:tooltip", "Move Selected Content"));
-
     m_d->checkBoxAntiAliasSelection->setToolTip(
         i18n("Smooths the edges of the selection"));
     m_d->sliderGrowSelection->setToolTip(
@@ -290,8 +282,6 @@ KisSelectionOptions::KisSelectionOptions(QWidget *parent)
     sectionReference->setWidgetVisible("widgetLabels", false);
     appendWidget("sectionReference", sectionReference);
 
-
-    appendWidget("checkBoxMoveSelectedContent", m_d->checkBoxMoveSelectedContent);
     appendWidget("sapCheckBox", m_d->checkBoxSelectionActionsPanel);
 
     KisOptionCollectionWidgetWithHeader *sectionAdjustments =
@@ -317,9 +307,6 @@ KisSelectionOptions::KisSelectionOptions(QWidget *parent)
             [this](int i, int c) {
                 m_d->on_optionButtonStripAction_buttonToggled(i, c);
             });
-    connect(m_d->checkBoxMoveSelectedContent,
-             SIGNAL(toggled(bool)),
-             SIGNAL(moveSelectedContentChanged(bool)));
     connect(m_d->checkBoxAntiAliasSelection,
             SIGNAL(toggled(bool)),
             SIGNAL(antiAliasSelectionChanged(bool)));
@@ -363,11 +350,6 @@ SelectionAction KisSelectionOptions::action() const
         m_d->optionButtonStripAction->checkedButtonIndex());
 }
 
-bool KisSelectionOptions::moveSelectedContent() const
-{
-    return m_d->checkBoxMoveSelectedContent->isChecked();
-}
-
 bool KisSelectionOptions::antiAliasSelection() const
 {
     return m_d->checkBoxAntiAliasSelection->isChecked();
@@ -418,11 +400,6 @@ void KisSelectionOptions::setAction(SelectionAction newAction)
     button->setChecked(true);
 }
 
-void KisSelectionOptions::setMoveSelectedContent(bool newMoveSelectedContent)
-{
-    m_d->checkBoxMoveSelectedContent->setChecked(newMoveSelectedContent);
-}
-
 void KisSelectionOptions::setAntiAliasSelection(bool newAntiAliasSelection)
 {
     m_d->checkBoxAntiAliasSelection->setChecked(newAntiAliasSelection);
diff --git a/libs/ui/widgets/kis_selection_options.h b/libs/ui/widgets/kis_selection_options.h
index 876d6901633..b98c7bfb796 100644
--- a/libs/ui/widgets/kis_selection_options.h
+++ b/libs/ui/widgets/kis_selection_options.h
@@ -26,7 +26,6 @@ public:
 
     SelectionMode mode() const;
     SelectionAction action() const;
-    bool moveSelectedContent() const;
     bool antiAliasSelection() const;
     int growSelection() const;
     bool stopGrowingAtDarkestPixel() const;
@@ -36,7 +35,6 @@ public:
 
     void setMode(SelectionMode newMode);
     void setAction(SelectionAction newAction);
-    void setMoveSelectedContent(bool newMoveSelectedContent);
     void setAntiAliasSelection(bool newAntiAliasSelection);
     void setGrowSelection(int newGrowSelection);
     void setStopGrowingAtDarkestPixel(bool newStopGrowingAtDarkestPixel);
@@ -56,7 +54,6 @@ public:
 Q_SIGNALS:
     void modeChanged(SelectionMode mode);
     void actionChanged(SelectionAction action);
-    void moveSelectedContentChanged(bool moveSelectedContent);
     void antiAliasSelectionChanged(bool antiAliasSelection);
     void growSelectionChanged(int growSelection);
     void stopGrowingAtDarkestPixelChanged(bool stopGrowingAtDarkestPixel);
diff --git a/plugins/tools/basictools/CMakeLists.txt b/plugins/tools/basictools/CMakeLists.txt
index b639f29ae48..733a0488cfa 100644
--- a/plugins/tools/basictools/CMakeLists.txt
+++ b/plugins/tools/basictools/CMakeLists.txt
@@ -13,6 +13,7 @@ set(kritadefaulttools_static_SRCS
     kis_tool_path.cc
     kis_tool_move.cc
     kis_tool_movetooloptionswidget.cpp
+    strokes/move_selection_stroke_strategy.cpp
     KisMoveBoundsCalculationJob.cpp
     kis_tool_multihand.cpp
     kis_tool_multihand_config.cpp
diff --git a/libs/ui/tool/strokes/move_selection_stroke_strategy.cpp b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp
similarity index 98%
rename from libs/ui/tool/strokes/move_selection_stroke_strategy.cpp
rename to plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp
index 3af9a032f78..754295906e6 100644
--- a/libs/ui/tool/strokes/move_selection_stroke_strategy.cpp
+++ b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.cpp
@@ -36,7 +36,7 @@ MoveSelectionStrokeStrategy::MoveSelectionStrokeStrategy(KisPaintLayerSP paintLa
      * all of them are completed before we start our stroke.
      */
     enableJob(KisSimpleStrokeStrategy::JOB_INIT, true, KisStrokeJobData::BARRIER);
-    enableJob(KisSimpleStrokeStrategy::JOB_FINISH, true, KisStrokeJobData::BARRIER);
+    enableJob(KisSimpleStrokeStrategy::JOB_FINISH);
     enableJob(KisSimpleStrokeStrategy::JOB_CANCEL);
 }
 
diff --git a/libs/ui/tool/strokes/move_selection_stroke_strategy.h b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
similarity index 89%
rename from libs/ui/tool/strokes/move_selection_stroke_strategy.h
rename to plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
index de2dd612795..178d7157882 100644
--- a/libs/ui/tool/strokes/move_selection_stroke_strategy.h
+++ b/plugins/tools/basictools/strokes/move_selection_stroke_strategy.h
@@ -7,7 +7,6 @@
 #ifndef __MOVE_SELECTION_STROKE_STRATEGY_H
 #define __MOVE_SELECTION_STROKE_STRATEGY_H
 
-#include "kritaui_export.h"
 #include "kis_stroke_strategy_undo_command_based.h"
 #include "kis_types.h"
 #include "kis_selection.h"
@@ -17,12 +16,12 @@ class KisPostExecutionUndoAdapter;
 class KisUpdatesFacade;
 
 
-class KRITAUI_EXPORT MoveSelectionStrokeStrategy : public QObject, public KisStrokeStrategyUndoCommandBased
+class MoveSelectionStrokeStrategy : public QObject, public KisStrokeStrategyUndoCommandBased
 {
     Q_OBJECT
 
 public:
-    struct KRITAUI_EXPORT ShowSelectionData : public KisStrokeJobData
+    struct ShowSelectionData : public KisStrokeJobData
     {
         ShowSelectionData(bool _showSelection)
             : KisStrokeJobData(),
diff --git a/plugins/tools/basictools/tests/CMakeLists.txt b/plugins/tools/basictools/tests/CMakeLists.txt
index edc404dcffe..56c8f6d842b 100644
--- a/plugins/tools/basictools/tests/CMakeLists.txt
+++ b/plugins/tools/basictools/tests/CMakeLists.txt
@@ -3,4 +3,11 @@
 krita_add_broken_unit_test(move_stroke_test.cpp  $<TARGET_PROPERTY:kritatestsdk,SOURCE_DIR>/stroke_testing_utils.cpp
     TEST_NAME MoveStrokeTest
     LINK_LIBRARIES kritadefaulttools_static kritabasicflakes kritaui kritatestsdk
-    )
\ No newline at end of file
+    )
+
+########### next target ###############
+
+kis_add_test(move_selection_stroke_test.cpp  $<TARGET_PROPERTY:kritatestsdk,SOURCE_DIR>/stroke_testing_utils.cpp ../strokes/move_selection_stroke_strategy.cpp
+    TEST_NAME MoveSelectionStrokeTest
+    LINK_LIBRARIES kritadefaulttools_static kritabasicflakes kritaui kritatestsdk
+    )
diff --git a/libs/ui/tests/move_selection_stroke_test.cpp b/plugins/tools/basictools/tests/move_selection_stroke_test.cpp
similarity index 100%
rename from libs/ui/tests/move_selection_stroke_test.cpp
rename to plugins/tools/basictools/tests/move_selection_stroke_test.cpp
diff --git a/libs/ui/tests/move_selection_stroke_test.h b/plugins/tools/basictools/tests/move_selection_stroke_test.h
similarity index 100%
rename from libs/ui/tests/move_selection_stroke_test.h
rename to plugins/tools/basictools/tests/move_selection_stroke_test.h


More information about the kimageshop mailing list