Commit 8ff09e52 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix move action in the Bezier Selection Tool

We should route all the mouse events via begin/continue/endPrimaryAction
path in KisDelegatedSelectPathWrapper to make sure that extra selection
actions implemented by KisToolSelectBase are available to the user.

BUG:398294
parent ca902a45
......@@ -49,12 +49,6 @@ void KisToolSelectPath::requestStrokeCancellation()
localTool()->cancelPath();
}
void KisToolSelectPath::mousePressEvent(KoPointerEvent* event)
{
if (!selectionEditable()) return;
DelegatedSelectPathTool::mousePressEvent(event);
}
// Install an event filter to catch right-click events.
// This code is duplicated in kis_tool_path.cc
bool KisToolSelectPath::eventFilter(QObject *obj, QEvent *event)
......@@ -91,27 +85,48 @@ QList<QPointer<QWidget> > KisToolSelectPath::createOptionWidgets()
}
void KisDelegatedSelectPathWrapper::beginPrimaryAction(KoPointerEvent *event) {
mousePressEvent(event);
DelegatedSelectPathTool::mousePressEvent(event);
}
void KisDelegatedSelectPathWrapper::continuePrimaryAction(KoPointerEvent *event){
mouseMoveEvent(event);
DelegatedSelectPathTool::mouseMoveEvent(event);
}
void KisDelegatedSelectPathWrapper::endPrimaryAction(KoPointerEvent *event) {
mouseReleaseEvent(event);
DelegatedSelectPathTool::mouseReleaseEvent(event);
}
void KisDelegatedSelectPathWrapper::beginPrimaryDoubleClickAction(KoPointerEvent *event)
{
DelegatedSelectPathTool::mouseDoubleClickEvent(event);
}
void KisDelegatedSelectPathWrapper::mousePressEvent(KoPointerEvent *event)
{
// this event will be forwarded using beginPrimaryAction
Q_UNUSED(event);
}
void KisDelegatedSelectPathWrapper::mouseMoveEvent(KoPointerEvent *event)
{
DelegatedSelectPathTool::mouseMoveEvent(event);
}
void KisDelegatedSelectPathWrapper::mouseReleaseEvent(KoPointerEvent *event)
{
// this event will be forwarded using continuePrimaryAction
Q_UNUSED(event);
}
void KisDelegatedSelectPathWrapper::mouseDoubleClickEvent(KoPointerEvent *event)
{
// this event will be forwarded using endPrimaryAction
Q_UNUSED(event);
}
bool KisDelegatedSelectPathWrapper::hasUserInteractionRunning() const
{
/**
* KoCreatePathTool doesn't support moving interventions from KisToolselectBase,
* because it doesn't use begin/continue/endPrimaryAction and uses direct event
* handling instead.
*
* TODO: refactor KoCreatePathTool and port it to action infrastructure
*/
return true;
return localTool()->pathStarted();
}
......
......@@ -64,6 +64,13 @@ struct KisDelegatedSelectPathWrapper : public DelegatedSelectPathTool {
void beginPrimaryAction(KoPointerEvent *event) override;
void continuePrimaryAction(KoPointerEvent *event) override;
void endPrimaryAction(KoPointerEvent *event) override;
void beginPrimaryDoubleClickAction(KoPointerEvent *event) override;
void mousePressEvent(KoPointerEvent *event) override;
void mouseMoveEvent(KoPointerEvent *event) override;
void mouseReleaseEvent(KoPointerEvent *event) override;
void mouseDoubleClickEvent(KoPointerEvent *event) override;
bool hasUserInteractionRunning() const;
};
......@@ -74,7 +81,6 @@ class KisToolSelectPath : public KisToolSelectBase<KisDelegatedSelectPathWrapper
Q_OBJECT
public:
KisToolSelectPath(KoCanvasBase * canvas);
void mousePressEvent(KoPointerEvent* event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
void resetCursorStyle() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment