[Inspector/FretDiagram] Update NotationPaintView when clicking Reset button

This commit is contained in:
Casper Jeukendrup 2021-10-09 18:41:05 +02:00
parent be8455afd5
commit d2641f8514
No known key found for this signature in database
GPG key ID: 6C571BEF59E722DD

View file

@ -35,10 +35,6 @@
using namespace mu::inspector; using namespace mu::inspector;
//---------------------------------------------------------
// FretCanvas
//---------------------------------------------------------
FretCanvas::FretCanvas(QQuickItem* parent) FretCanvas::FretCanvas(QQuickItem* parent)
: QQuickPaintedItem(parent) : QQuickPaintedItem(parent)
{ {
@ -49,10 +45,6 @@ FretCanvas::FretCanvas(QQuickItem* parent)
m_cfret = -2; m_cfret = -2;
} }
//---------------------------------------------------------
// paintEvent
//---------------------------------------------------------
void FretCanvas::draw(QPainter* painter) void FretCanvas::draw(QPainter* painter)
{ {
double mag = 1.5; 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) void FretCanvas::paintDotSymbol(QPainter* p, QPen& pen, qreal x, qreal y, qreal dotd, Ms::FretDotType dtype)
{ {
switch (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) void FretCanvas::getPosition(const QPointF& p, int* string, int* fret)
{ {
double mag = 1.5; 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; *string = (p.x() - xo + stringDist * .5) / stringDist;
} }
//---------------------------------------------------------
// mousePressEvent
//---------------------------------------------------------
void FretCanvas::mousePressEvent(QMouseEvent* ev) void FretCanvas::mousePressEvent(QMouseEvent* ev)
{ {
int string; int string;
@ -327,10 +307,6 @@ void FretCanvas::mousePressEvent(QMouseEvent* ev)
globalContext()->currentNotation()->notationChanged().notify(); globalContext()->currentNotation()->notationChanged().notify();
} }
//---------------------------------------------------------
// hoverMoveEvent
//---------------------------------------------------------
void FretCanvas::hoverMoveEvent(QHoverEvent* ev) void FretCanvas::hoverMoveEvent(QHoverEvent* ev)
{ {
int string; int string;
@ -343,10 +319,6 @@ void FretCanvas::hoverMoveEvent(QHoverEvent* ev)
} }
} }
//---------------------------------------------------------
// setFretDiagram
//---------------------------------------------------------
void FretCanvas::setFretDiagram(QVariant fd) void FretCanvas::setFretDiagram(QVariant fd)
{ {
m_diagram = fd.value<Ms::FretDiagram*>(); m_diagram = fd.value<Ms::FretDiagram*>();
@ -363,16 +335,14 @@ void FretCanvas::setFretDiagram(QVariant fd)
update(); update();
} }
//---------------------------------------------------------
// clear
//---------------------------------------------------------
void FretCanvas::clear() void FretCanvas::clear()
{ {
m_diagram->score()->startCmd(); globalContext()->currentNotation()->undoStack()->prepareChanges();
m_diagram->undoFretClear(); m_diagram->undoFretClear();
m_diagram->score()->endCmd(); globalContext()->currentNotation()->undoStack()->commitChanges();
update(); update();
globalContext()->currentNotation()->notationChanged().notify();
} }
void FretCanvas::paint(QPainter* painter) void FretCanvas::paint(QPainter* painter)