fix TremoloBar drag&drop

This commit is contained in:
ws 2015-11-05 13:34:50 +01:00
parent e26e3294a4
commit c96c78fbc6
4 changed files with 8 additions and 8 deletions

View file

@ -893,7 +893,6 @@ Element* ChordRest::drop(const DropData& data)
case Element::Type::FRET_DIAGRAM:
case Element::Type::TREMOLOBAR:
case Element::Type::SYMBOL:
printf("drop %s\n", e->name());
e->setTrack(track());
e->setParent(segment());
score()->undoAddElement(e);

View file

@ -27,7 +27,7 @@ namespace Ms {
TremoloBar::TremoloBar(Score* s)
: Element(s)
{
setFlag(ElementFlag::ON_STAFF, true);
setFlags(ElementFlag::MOVABLE | ElementFlag::SELECTABLE);
}
//---------------------------------------------------------
@ -38,6 +38,7 @@ void TremoloBar::layout()
{
qreal _spatium = spatium();
setPos(0.0, 0.0);
if (staff() && !staff()->isTabStaff()) {
setbbox(QRectF());
if (!parent()) {
@ -92,7 +93,7 @@ void TremoloBar::draw(QPainter* painter) const
int n = _points.size();
int previousTime = _points[0].time;
int previousTime = _points[0].time;
int previousPitch = _points[0].pitch;
/* we place the tremolo bars starting slightly before the
* notehead, and end it slightly after, drawing above the
@ -101,8 +102,8 @@ void TremoloBar::draw(QPainter* painter) const
* timeFactor and pitchFactor below to reduce these values down
* consistently to values that make sense to draw with the
* Musescore scale. */
qreal timeFactor = 10; // * _userMag;
qreal pitchFactor = 25; // * _userMag;
qreal timeFactor = 10.0 / _userMag;
qreal pitchFactor = 25.0 / _userMag;
for (int pt = 1; pt < n; ++pt) {
painter->drawLine(QLineF(previousTime/timeFactor, -previousPitch/pitchFactor-_spatium*3,
_points[pt].time/timeFactor, -_points[pt].pitch/pitchFactor-_spatium*3));

View file

@ -860,9 +860,7 @@ void SegmentView::setElement(Element* e)
sb.spannerBack->clear();
sb.annotations->clear();
foreach(Element* sp, s->annotations()) {
QString s;
s.setNum(qptrdiff(sp), 16);
QListWidgetItem* item = new QListWidgetItem(s);
QListWidgetItem* item = new QListWidgetItem(QString("%1 %2").arg(qptrdiff(sp), 8, 16).arg(sp->name()));
item->setData(Qt::UserRole, QVariant::fromValue<void*>((void*)sp));
sb.annotations->addItem(item);
}

View file

@ -376,6 +376,7 @@ void ScoreView::dragMoveEvent(QDragMoveEvent* event)
case Element::Type::HARMONY:
case Element::Type::BAGPIPE_EMBELLISHMENT:
case Element::Type::AMBITUS:
case Element::Type::TREMOLOBAR:
{
QList<Element*> el = elementsAt(pos);
bool found = false;
@ -564,6 +565,7 @@ void ScoreView::dropEvent(QDropEvent* event)
case Element::Type::SLUR:
case Element::Type::BAGPIPE_EMBELLISHMENT:
case Element::Type::AMBITUS:
case Element::Type::TREMOLOBAR:
{
Element* el = 0;
for (const Element* e : elementsAt(pos)) {