Skip to content

Commit

Permalink
fix #65961: dotted line when dragging text
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella authored and lasconic committed Jun 21, 2015
1 parent 37e54f6 commit 7846410
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 52 deletions.
15 changes: 0 additions & 15 deletions libmscore/dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,6 @@ void Dynamic::reset()
Text::reset();
}

//---------------------------------------------------------
// dragAnchor
//---------------------------------------------------------

QLineF Dynamic::dragAnchor() const
{
qreal xp = 0.0;
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp = measure()->system()->staffYpage(staffIdx());
QPointF p(xp, yp);

return QLineF(p, canvasPos());
}

//---------------------------------------------------------
// drag
//---------------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions libmscore/dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ class Dynamic : public Text {
void setDynRange(Range t) { _dynRange = t; }
void undoSetDynRange(Range t);

virtual QLineF dragAnchor() const override;

virtual QVariant getProperty(P_ID propertyId) const override;
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
virtual QVariant propertyDefault(P_ID id) const override;
Expand Down
18 changes: 0 additions & 18 deletions libmscore/harmony.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,24 +1467,6 @@ void Harmony::textStyleChanged()
render();
}

//---------------------------------------------------------
// dragAnchor
//---------------------------------------------------------

QLineF Harmony::dragAnchor() const
{
qreal xp = 0.0;
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp;
if (parent()->type() == Element::Type::SEGMENT)
yp = static_cast<Segment*>(parent())->measure()->system()->staffYpage(staffIdx());
else
yp = parent()->canvasPos().y();
QPointF p(xp, yp);
return QLineF(p, canvasPos());
}

//---------------------------------------------------------
// extensionName
//---------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion libmscore/harmony.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class Harmony : public Text {
virtual void spatiumChanged(qreal oldValue, qreal newValue) override;
virtual void localSpatiumChanged(qreal oldValue, qreal newValue) override;
virtual void textStyleChanged() override;
virtual QLineF dragAnchor() const override;
void setHarmony(const QString& s);
virtual QPainterPath shape() const override;
void calculateBoundingRect();
Expand Down
15 changes: 0 additions & 15 deletions libmscore/instrchange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,6 @@ bool InstrumentChange::setProperty(P_ID propertyId, const QVariant& v)
return true;
}

//---------------------------------------------------------
// dragAnchor
//---------------------------------------------------------

QLineF InstrumentChange::dragAnchor() const
{
qreal xp = 0.0;
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp = segment()->measure()->system()->staffYpage(staffIdx());
QPointF p(xp, yp);

return QLineF(p, canvasPos());
}

//---------------------------------------------------------
// drag
//---------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion libmscore/instrchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class InstrumentChange : public Text {

Segment* segment() const { return (Segment*)parent(); }

virtual QLineF dragAnchor() const override;
virtual QRectF drag(EditData*) override;

virtual QVariant getProperty(P_ID propertyId) const override;
Expand Down
21 changes: 21 additions & 0 deletions libmscore/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2432,6 +2432,27 @@ void Text::dragTo(const QPointF& p)
score()->end();
}

//---------------------------------------------------------
// dragAnchor
//---------------------------------------------------------

QLineF Text::dragAnchor() const
{
qreal xp = 0.0;
for (Element* e = parent(); e; e = e->parent())
xp += e->x();
qreal yp;
if (parent()->type() == Element::Type::SEGMENT)
yp = static_cast<Segment*>(parent())->measure()->system()->staffYpage(staffIdx());
else
yp = parent()->canvasPos().y();
QPointF p1(xp, yp);
QPointF p2 = canvasPos();
if (layoutToParentWidth())
p2 += bbox().topLeft();
return QLineF(p1, p2);
}

//---------------------------------------------------------
// getProperty
//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions libmscore/text.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ class Text : public Element {
void setAbove(bool val) { textStyle().setYoff(val ? -2.0 : 7.0); }
void dragTo(const QPointF&);

virtual QLineF dragAnchor() const override;

QVariant getProperty(P_ID propertyId) const;
bool setProperty(P_ID propertyId, const QVariant& v);
virtual QVariant propertyDefault(P_ID id) const;
Expand Down

0 comments on commit 7846410

Please sign in to comment.