From d2641f8514c7d3497552f8ee989468e1a0a99e6d Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Sat, 9 Oct 2021 18:41:05 +0200 Subject: [PATCH] [Inspector/FretDiagram] Update NotationPaintView when clicking Reset button --- src/inspector/view/widgets/fretcanvas.cpp | 38 +++-------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/src/inspector/view/widgets/fretcanvas.cpp b/src/inspector/view/widgets/fretcanvas.cpp index 4d5e0693705c7..c13535c2254ad 100644 --- a/src/inspector/view/widgets/fretcanvas.cpp +++ b/src/inspector/view/widgets/fretcanvas.cpp @@ -35,10 +35,6 @@ using namespace mu::inspector; -//--------------------------------------------------------- -// FretCanvas -//--------------------------------------------------------- - FretCanvas::FretCanvas(QQuickItem* parent) : QQuickPaintedItem(parent) { @@ -49,10 +45,6 @@ FretCanvas::FretCanvas(QQuickItem* parent) m_cfret = -2; } -//--------------------------------------------------------- -// paintEvent -//--------------------------------------------------------- - void FretCanvas::draw(QPainter* painter) { double mag = 1.5; @@ -183,10 +175,6 @@ void FretCanvas::draw(QPainter* painter) } } -//--------------------------------------------------------- -// paintDotSymbol -//--------------------------------------------------------- - void FretCanvas::paintDotSymbol(QPainter* p, QPen& pen, qreal x, qreal y, qreal dotd, Ms::FretDotType dtype) { switch (dtype) { @@ -212,10 +200,6 @@ void FretCanvas::paintDotSymbol(QPainter* p, QPen& pen, qreal x, qreal y, qreal } } -//--------------------------------------------------------- -// getPosition -//--------------------------------------------------------- - void FretCanvas::getPosition(const QPointF& p, int* string, int* fret) { double mag = 1.5; @@ -233,10 +217,6 @@ void FretCanvas::getPosition(const QPointF& p, int* string, int* fret) *string = (p.x() - xo + stringDist * .5) / stringDist; } -//--------------------------------------------------------- -// mousePressEvent -//--------------------------------------------------------- - void FretCanvas::mousePressEvent(QMouseEvent* ev) { int string; @@ -327,10 +307,6 @@ void FretCanvas::mousePressEvent(QMouseEvent* ev) globalContext()->currentNotation()->notationChanged().notify(); } -//--------------------------------------------------------- -// hoverMoveEvent -//--------------------------------------------------------- - void FretCanvas::hoverMoveEvent(QHoverEvent* ev) { int string; @@ -343,10 +319,6 @@ void FretCanvas::hoverMoveEvent(QHoverEvent* ev) } } -//--------------------------------------------------------- -// setFretDiagram -//--------------------------------------------------------- - void FretCanvas::setFretDiagram(QVariant fd) { m_diagram = fd.value(); @@ -363,16 +335,14 @@ void FretCanvas::setFretDiagram(QVariant fd) update(); } -//--------------------------------------------------------- -// clear -//--------------------------------------------------------- - void FretCanvas::clear() { - m_diagram->score()->startCmd(); + globalContext()->currentNotation()->undoStack()->prepareChanges(); m_diagram->undoFretClear(); - m_diagram->score()->endCmd(); + globalContext()->currentNotation()->undoStack()->commitChanges(); update(); + + globalContext()->currentNotation()->notationChanged().notify(); } void FretCanvas::paint(QPainter* painter)