当前位置: 首页>>代码示例>>C++>>正文


C++ Slur::endElement方法代码示例

本文整理汇总了C++中Slur::endElement方法的典型用法代码示例。如果您正苦于以下问题:C++ Slur::endElement方法的具体用法?C++ Slur::endElement怎么用?C++ Slur::endElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Slur的用法示例。


在下文中一共展示了Slur::endElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: edit

bool SlurSegment::edit(MuseScoreView* viewer, int curGrip, int key, Qt::KeyboardModifiers modifiers, const QString&)
      {
      Slur* sl = static_cast<Slur*>(slurTie());

      if (key == Qt::Key_X) {
            sl->setSlurDirection(sl->up() ? MScore::DOWN : MScore::UP);
            sl->layout();
            return true;
            }
      if (slurTie()->type() != SLUR)
            return false;

      if (!((modifiers & Qt::ShiftModifier)
         && ((subtype() == SEGMENT_SINGLE)
              || (subtype() == SEGMENT_BEGIN && curGrip == 0)
              || (subtype() == SEGMENT_END && curGrip == 3)
            )))
            return false;

      ChordRest* cr = 0;
      Element* e    = curGrip == 0 ? sl->startElement() : sl->endElement();
      Element* e1   = curGrip == 0 ? sl->endElement() : sl->startElement();

      if (key == Qt::Key_Left)
            cr = prevChordRest((ChordRest*)e);
      else if (key == Qt::Key_Right)
            cr = nextChordRest((ChordRest*)e);

      if (cr == 0 || cr == (ChordRest*)e1)
            return true;
      changeAnchor(viewer, curGrip, cr);
      return true;
      }
开发者ID:kuribas,项目名称:MuseScore,代码行数:33,代码来源:slur.cpp

示例2: changeAnchor

void SlurSegment::changeAnchor(MuseScoreView* viewer, int curGrip, ChordRest* cr)
      {
      Slur* sl = static_cast<Slur*>(slurTie());
      if (curGrip == 0) {
            ((ChordRest*)sl->startElement())->removeSlurFor(sl);
            sl->setStartElement(cr);
            cr->addSlurFor(sl);
            }
      else {
            ((ChordRest*)sl->endElement())->removeSlurBack(sl);
            sl->setEndElement(cr);
            cr->addSlurBack(sl);
            }

      int segments  = sl->spannerSegments().size();
      ups[curGrip].off = QPointF();
      sl->layout();
      if (sl->spannerSegments().size() != segments) {
            SlurSegment* newSegment = curGrip == 3 ? sl->backSegment() : sl->frontSegment();
            score()->endCmd();
            score()->startCmd();
            viewer->startEdit(newSegment, curGrip);
            score()->setLayoutAll(true);
            }
      }
开发者ID:kuribas,项目名称:MuseScore,代码行数:25,代码来源:slur.cpp

示例3: editDrag

void SlurSegment::editDrag(const EditData& ed)
      {
      qreal _spatium = spatium();
      ups[ed.curGrip].off += (ed.delta / _spatium);
      if (ed.curGrip == GRIP_START || ed.curGrip == GRIP_END) {
            slurTie()->computeBezier(this);
            //
            // move anchor for slurs
            //
            Slur* slur = static_cast<Slur*>(slurTie());
            Element* e = ed.view->elementNear(ed.pos);
            if ((slur->type() == SLUR)
               && (
                  (ed.curGrip == GRIP_START && (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_BEGIN))
                  || (ed.curGrip == GRIP_END && (subtype() == SEGMENT_SINGLE || subtype() == SEGMENT_END))
                  )
               ) {
                  if (e && e->type() == NOTE) {
                        Chord* chord = static_cast<Note*>(e)->chord();
                        if ((ed.curGrip == GRIP_END && chord != slur->endElement())
                           || (ed.curGrip == GRIP_START && chord != slur->startElement())) {
                              changeAnchor(ed.view, ed.curGrip, chord);
                              QPointF p1 = ed.pos - ups[ed.curGrip].p - pagePos();
                              ups[ed.curGrip].off = p1 / _spatium;
                              return;
                              }
                        }
                  }
            }
      else if (ed.curGrip == GRIP_BEZIER1 || ed.curGrip == GRIP_BEZIER2)
            slurTie()->computeBezier(this);
      else if (ed.curGrip == GRIP_SHOULDER) {
            ups[ed.curGrip].off = QPointF();
            slurTie()->computeBezier(this, ed.delta);
            }
      else if (ed.curGrip == GRIP_DRAG) {
            ups[GRIP_DRAG].off = QPointF();
            setUserOff(userOff() + ed.delta);
            }
      }
开发者ID:kuribas,项目名称:MuseScore,代码行数:40,代码来源:slur.cpp

示例4: foreach

 foreach(Element* e, _gel) {
       if (e->type() != SLUR)
             continue;
       Slur* s = (Slur*)e;
       Element* n1 = s->startElement();
       Element* n2 = s->endElement();
       if (n1 == 0 || n2 == 0 || n1 == n2) {
             printf("unconnected slur: removing\n");
             if (n1) {
                   ((ChordRest*)n1)->removeSlurFor(s);
                   ((ChordRest*)n1)->removeSlurBack(s);
                   }
             if (n1 == 0)
                   printf("  start at %d(%d) not found\n", s->tick(), s->track());
             if (n2 == 0)
                   printf("  end at %d(%d) not found\n", s->tick2(), s->track2());
             if ((n1 || n2) && (n1==n2))
                   printf("  start == end\n");
             int idx = _gel.indexOf(s);
             _gel.removeAt(idx);
             }
       }
开发者ID:SSMN,项目名称:MuseScore,代码行数:22,代码来源:check.cpp


注:本文中的Slur::endElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。