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


C++ ChordRest::pagePos方法代码示例

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


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

示例1: slurPos

void Slur::slurPos(SlurPos* sp)
      {
      qreal _spatium = spatium();
      Element* e1 = startElement();
      Element* e2 = endElement();

      if (e2 == 0) {
            sp->p1 = e1->pagePos();
            sp->p1.rx() += e1->width();
            sp->p2 = sp->p1;
            sp->p2.rx() += 5 * _spatium;
            sp->system1 = static_cast<ChordRest*>(e1)->measure()->system();
            sp->system2 = sp->system1;
            return;
            }

      ChordRest* scr   = static_cast<ChordRest*>(e1);
      ChordRest* ecr   = static_cast<ChordRest*>(e2);
      Chord* sc   = 0;
      Note* note1 = 0;
      if(e1->type() == CHORD) {
            sc = static_cast<Chord*>(e1);
            note1 = _up ? sc->upNote() : sc->downNote();
            }
      Chord* ec = 0;
      Note* note2 = 0;
      if(e2->type() == CHORD) {
            ec   = static_cast<Chord*>(e2);
            note2 = _up ? ec->upNote() : ec->downNote();
            }

      sp->system1 = scr->measure()->system();
      sp->system2 = ecr->measure()->system();
      sp->p1      = scr->pagePos() - sp->system1->pagePos();
      sp->p2      = ecr->pagePos() - sp->system2->pagePos();

      qreal xo, yo;

      Stem* stem1 = sc?sc->stem():0;
      Stem* stem2 = ec?ec->stem():0;

      enum SlurAnchor {
            SA_NONE, SA_STEM
            };
      SlurAnchor sa1 = SA_NONE;
      SlurAnchor sa2 = SA_NONE;
      if ((scr->up() == ecr->up()) && !scr->beam() && !ecr->beam() && (_up == scr->up())) {
            if (stem1)
                  sa1 = SA_STEM;
            if (stem2)
                  sa2 = SA_STEM;
            }

      qreal __up = _up ? -1.0 : 1.0;
      qreal hw   = note1?note1->headWidth():e1->width();
      switch (sa1) {
            case SA_STEM: //sc can't be null
                  sp->p1 += sc->stemPosBeam() - sc->pagePos() + sc->stem()->p2();
                  sp->p1 += QPointF(0.35 * _spatium, 0.25 * _spatium);
                  break;
            case SA_NONE:
                  break;
            }
      switch(sa2) {
            case SA_STEM: //ec can't be null
                  sp->p2 += ec->stemPosBeam() - ec->pagePos() + ec->stem()->p2();
                  sp->p2 += QPointF(-0.35 * _spatium, 0.25 * _spatium);
                  break;
            case SA_NONE:
                  break;
            }

      //
      // default position:
      //    horizontal: middle of note head
      //    vertical:   _spatium * .4 above/below note head
      //
      //------p1
      bool stemPos = false;   // p1 starts at chord stem side
      if (note1)
            yo = note1->pos().y();
      else if(_up)
            yo = e1->bbox().top();
      else
            yo = e1->bbox().top() + e1->height();
      yo += _spatium * .9 * __up;
      xo = hw * .5;

      if (stem1) { //sc not null
            Beam* beam1 = sc->beam();
            if (beam1 && (beam1->elements().back() != sc) && (sc->up() == _up)) {
                  qreal sh = stem1->height() + _spatium;
                  yo       = sc->downNote()->pos().y() + sh * __up;
                  xo       = stem1->pos().x();
                  stemPos  = true;
                  }
            else {
                  if (sc->up() && _up)
                        xo = hw + _spatium * .3;
                  //
//.........这里部分代码省略.........
开发者ID:elerouxx,项目名称:MuseScore,代码行数:101,代码来源:slur.cpp


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