diff --git a/src/engraving/dom/mscoreview.h b/src/engraving/dom/mscoreview.h index 84d4fd943690a..29a23697ac2bf 100644 --- a/src/engraving/dom/mscoreview.h +++ b/src/engraving/dom/mscoreview.h @@ -59,7 +59,7 @@ class MuseScoreView virtual void setDropRectangle(const RectF&) {} virtual void startNoteEntryMode() {} virtual void drawBackground(muse::draw::Painter*, const RectF&) const = 0; - virtual void setDropTarget(const EngravingItem*) {} + virtual void setDropTarget(EngravingItem*) {} virtual void textTab(bool /*back*/) {} diff --git a/src/notation/inotationinteraction.h b/src/notation/inotationinteraction.h index 11fe533f6f71b..c9368559d0145 100644 --- a/src/notation/inotationinteraction.h +++ b/src/notation/inotationinteraction.h @@ -106,7 +106,7 @@ class INotationInteraction virtual bool startDrop(const QUrl& url) = 0; virtual bool isDropAccepted(const muse::PointF& pos, Qt::KeyboardModifiers modifiers) = 0; //! NOTE Also may set drop target virtual bool drop(const muse::PointF& pos, Qt::KeyboardModifiers modifiers) = 0; - virtual void setDropTarget(const EngravingItem* item, bool notify = true) = 0; + virtual void setDropTarget(EngravingItem* item, bool notify = true) = 0; virtual void setDropRect(const muse::RectF& rect) = 0; virtual void endDrop() = 0; virtual muse::async::Notification dropChanged() const = 0; diff --git a/src/notation/internal/notationinteraction.cpp b/src/notation/internal/notationinteraction.cpp index daad1cf806947..b4f52035446a8 100644 --- a/src/notation/internal/notationinteraction.cpp +++ b/src/notation/internal/notationinteraction.cpp @@ -1530,7 +1530,7 @@ bool NotationInteraction::drop(const PointF& pos, Qt::KeyboardModifiers modifier //! NOTE: Helper method for NotationInteraction::drop. Handles drop logic for majority of elements (returns "accepted") bool NotationInteraction::doDropStandard() { - EngravingItem* el = dropTarget(m_dropData.ed); + EngravingItem* el = m_dropData.dropTarget ? m_dropData.dropTarget : dropTarget(m_dropData.ed); if (!el) { if (!dropCanvas(m_dropData.ed.dropElement)) { LOGD("cannot drop %s(%p) to canvas", m_dropData.ed.dropElement->typeName(), m_dropData.ed.dropElement); @@ -2441,7 +2441,7 @@ bool NotationInteraction::dragTimeAnchorElement(const PointF& pos) } //! NOTE Copied from ScoreView::setDropTarget -void NotationInteraction::setDropTarget(const EngravingItem* item, bool notify) +void NotationInteraction::setDropTarget(EngravingItem* item, bool notify) { if (m_dropData.dropTarget != item) { if (m_dropData.dropTarget) { diff --git a/src/notation/internal/notationinteraction.h b/src/notation/internal/notationinteraction.h index fe265f57eb49c..60960572b164c 100644 --- a/src/notation/internal/notationinteraction.h +++ b/src/notation/internal/notationinteraction.h @@ -113,7 +113,7 @@ class NotationInteraction : public INotationInteraction, public muse::Injectable bool startDrop(const QUrl& url) override; bool isDropAccepted(const muse::PointF& pos, Qt::KeyboardModifiers modifiers) override; bool drop(const muse::PointF& pos, Qt::KeyboardModifiers modifiers) override; - void setDropTarget(const EngravingItem* item, bool notify = true) override; + void setDropTarget(EngravingItem* item, bool notify = true) override; void setDropRect(const muse::RectF& rect) override; void endDrop() override; muse::async::Notification dropChanged() const override; @@ -417,7 +417,7 @@ class NotationInteraction : public INotationInteraction, public muse::Injectable struct DropData { mu::engraving::EditData ed; - const EngravingItem* dropTarget = nullptr; + EngravingItem* dropTarget = nullptr; muse::RectF dropRect; }; diff --git a/src/notation/internal/scorecallbacks.cpp b/src/notation/internal/scorecallbacks.cpp index 37b054195690a..b4335a10a171f 100644 --- a/src/notation/internal/scorecallbacks.cpp +++ b/src/notation/internal/scorecallbacks.cpp @@ -63,7 +63,7 @@ void ScoreCallbacks::setSelectionProximity(qreal proximity) m_selectionProximity = proximity; } -void ScoreCallbacks::setDropTarget(const mu::engraving::EngravingItem* dropTarget) +void ScoreCallbacks::setDropTarget(mu::engraving::EngravingItem* dropTarget) { IF_ASSERT_FAILED(m_interaction) { return; diff --git a/src/notation/internal/scorecallbacks.h b/src/notation/internal/scorecallbacks.h index f36ba7f129c81..9f9654081fcc7 100644 --- a/src/notation/internal/scorecallbacks.h +++ b/src/notation/internal/scorecallbacks.h @@ -42,7 +42,7 @@ class ScoreCallbacks : public mu::engraving::MuseScoreView void drawBackground(muse::draw::Painter*, const muse::RectF&) const override; const muse::Rect geometry() const override; qreal selectionProximity() const override; - void setDropTarget(const mu::engraving::EngravingItem* dropTarget) override; + void setDropTarget(mu::engraving::EngravingItem* dropTarget) override; void setDropRectangle(const muse::RectF& rect) override; void changeEditElement(mu::engraving::EngravingItem* newElement) override; void adjustCanvasPosition(const mu::engraving::EngravingItem*, int staffIdx = -1) override; diff --git a/src/notation/tests/mocks/notationinteractionmock.h b/src/notation/tests/mocks/notationinteractionmock.h index 78e8814906236..03b5fc0b5846d 100644 --- a/src/notation/tests/mocks/notationinteractionmock.h +++ b/src/notation/tests/mocks/notationinteractionmock.h @@ -74,7 +74,7 @@ class NotationInteractionMock : public INotationInteraction MOCK_METHOD(bool, startDrop, (const QUrl&), (override)); MOCK_METHOD(bool, isDropAccepted, (const muse::PointF&, Qt::KeyboardModifiers), (override)); MOCK_METHOD(bool, drop, (const muse::PointF&, Qt::KeyboardModifiers), (override)); - MOCK_METHOD(void, setDropTarget, (const EngravingItem*, bool), (override)); + MOCK_METHOD(void, setDropTarget, (EngravingItem*, bool), (override)); MOCK_METHOD(void, setDropRect, (const muse::RectF&), (override)); MOCK_METHOD(void, endDrop, (), (override)); MOCK_METHOD(muse::async::Notification, dropChanged, (), (const, override)); diff --git a/src/palette/view/widgets/notegroupsexampleview.cpp b/src/palette/view/widgets/notegroupsexampleview.cpp index 3691861407040..591b47253ff4e 100644 --- a/src/palette/view/widgets/notegroupsexampleview.cpp +++ b/src/palette/view/widgets/notegroupsexampleview.cpp @@ -103,12 +103,12 @@ void NoteGroupsExampleView::dragMoveEvent(QDragMoveEvent* event) return; } - const EngravingItem* newDropTarget = nullptr; + EngravingItem* newDropTarget = nullptr; PointF position = toLogical(event->position()); std::vector el = elementsAt(position); - for (const EngravingItem* e : el) { + for (EngravingItem* e : el) { if (e->type() == ElementType::NOTE) { newDropTarget = e; break; @@ -123,7 +123,7 @@ void NoteGroupsExampleView::dragMoveEvent(QDragMoveEvent* event) return; } -void NoteGroupsExampleView::setDropTarget(const EngravingItem* el) +void NoteGroupsExampleView::setDropTarget(EngravingItem* el) { if (m_dropTarget != el) { if (m_dropTarget) { diff --git a/src/palette/view/widgets/notegroupsexampleview.h b/src/palette/view/widgets/notegroupsexampleview.h index 786968250c73c..0d2bc04ebc344 100644 --- a/src/palette/view/widgets/notegroupsexampleview.h +++ b/src/palette/view/widgets/notegroupsexampleview.h @@ -49,7 +49,7 @@ class NoteGroupsExampleView : public notation::ExampleView void beamPropertyDropped(engraving::Chord*, engraving::ActionIcon*); private: - void setDropTarget(const engraving::EngravingItem* el) override; + void setDropTarget(engraving::EngravingItem* el) override; void dragEnterEvent(QDragEnterEvent*) override; void dragLeaveEvent(QDragLeaveEvent*) override;