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


C++ Articulation::width方法代码示例

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


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

示例1: layout

void BarLine::layout()
      {
      qreal y1, y2;
      getY(&y1, &y2);
      qreal _spatium = spatium();
      qreal dw = score()->styleS(ST_barWidth).val() * _spatium;

      qreal dotwidth = symbols[score()->symIdx()][dotSym].width(magS());
      switch(subtype()) {
            case DOUBLE_BAR:
                  dw  = (score()->styleS(ST_doubleBarWidth) * 2
                     + score()->styleS(ST_doubleBarDistance)).val() * _spatium;
                  break;
            case START_REPEAT:
                  dw += dotwidth + (score()->styleS(ST_endBarWidth)
                     + 2 * score()->styleS(ST_endBarDistance)).val() * _spatium;
                  break;
            case END_REPEAT:
                  dw += dotwidth + (score()->styleS(ST_endBarWidth)
                     + 2 * score()->styleS(ST_endBarDistance)).val() * _spatium;
                  break;
            case END_BAR:
                  dw += (score()->styleS(ST_endBarWidth)
                     + score()->styleS(ST_endBarDistance)).val() * _spatium;
                  break;
            case  END_START_REPEAT:
                  dw += 2 * dotwidth + (score()->styleS(ST_barWidth)
                     + score()->styleS(ST_endBarWidth)
                     + 4 * score()->styleS(ST_endBarDistance)).val() * _spatium;
                  break;
            case BROKEN_BAR:
            case NORMAL_BAR:
                  break;
            default:
                  qDebug("illegal bar line type\n");
                  break;
            }
      QRectF r(0.0, y1, dw, y2-y1);

      if (score()->styleB(ST_repeatBarTips)) {
            // qreal mags = magS();
            switch (subtype()) {
                  case START_REPEAT:
                        //r |= symbols[brackettipsRightUp].bbox(mags).translated(0, y1);
                        //r |= symbols[brackettipsRightDown].bbox(mags).translated(0, y2);
                        break;
                  case END_REPEAT:
                        //r |= symbols[brackettipsLeftUp].bbox(mags).translated(0, y1);
                        //r |= symbols[brackettipsLeftDown].bbox(mags).translated(0, y2);
                        break;
                  default:
                        break;
                  }
            }
      foreach(Element* e, _el) {
            e->layout();
            if (e->type() == ARTICULATION) {
                  Articulation* a       = static_cast<Articulation*>(e);
                  ArticulationAnchor aa = a->anchor();
                  qreal distance        = 0.5 * _spatium;
                  qreal topY            = y1 - distance;
                  qreal botY            = y2 + distance;
                  qreal x               = width() - (a->width() * .5);
                  if (aa == A_TOP_STAFF)
                        a->setPos(QPointF(x, topY));
                  else if (aa == A_BOTTOM_STAFF)
                        a->setPos(QPointF(x, botY));
                  }
            }
开发者ID:Mistobaan,项目名称:MuseScore,代码行数:69,代码来源:barline.cpp


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