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


C++ BarLine::setSpanTo方法代码示例

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


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

示例1: newBarLinePalette

Palette* MuseScore::newBarLinePalette()
      {
      Palette* sp = new Palette;
      sp->setName(QT_TRANSLATE_NOOP("Palette", "Barlines"));
      sp->setMag(0.8);
      sp->setGrid(42, 38);

      // bar line styles
      struct {
            BarLineType type;
            const char* name;
            } t[] = {
            { BarLineType::NORMAL,       QT_TRANSLATE_NOOP("Palette", "Normal") },
            { BarLineType::BROKEN,       QT_TRANSLATE_NOOP("Palette", "Dashed") },
            { BarLineType::DOTTED,       QT_TRANSLATE_NOOP("Palette", "Dotted") },
            { BarLineType::END,          QT_TRANSLATE_NOOP("Palette", "End Bar") },
            { BarLineType::DOUBLE,       QT_TRANSLATE_NOOP("Palette", "Double Bar") },
            { BarLineType::START_REPEAT,     QT_TRANSLATE_NOOP("Palette", "Start Repeat") },
            { BarLineType::END_REPEAT,       QT_TRANSLATE_NOOP("Palette", "End Repeat") },
            { BarLineType::END_START_REPEAT, QT_TRANSLATE_NOOP("Palette", "End-Start Repeat") },
            };
      for (unsigned i = 0; i < sizeof(t)/sizeof(*t); ++i) {
            BarLine* b  = new BarLine(gscore);
            b->setBarLineType(t[i].type);
            sp->append(b, t[i].name);
            }

      // bar line spans
      struct {
            int         from, to;
            const char* name;
            } span[] = {
            { -1, 1, QT_TRANSLATE_NOOP("Palette", "Tick 1") },
            { -2, 2, QT_TRANSLATE_NOOP("Palette", "Tick 2") },
            { 2,  6, QT_TRANSLATE_NOOP("Palette", "Short 1") },
            { 1,  7, QT_TRANSLATE_NOOP("Palette", "Short 2") },
            };
      for (unsigned i = 0; i < sizeof(span)/sizeof(*span); ++i) {
            BarLine* b  = new BarLine(gscore);
            b->setBarLineType(BarLineType::NORMAL);
            b->setSpanFrom(span[i].from);
            b->setSpanTo(span[i].to);
            sp->append(b, span[i].name);
            }
      return sp;
      }
开发者ID:jasonmarkbeaton,项目名称:MuseScore,代码行数:46,代码来源:menus.cpp

示例2: newBarLinePalette

Palette* MuseScore::newBarLinePalette()
      {
      Palette* sp = new Palette;
      sp->setName(qApp->translate("barlines", "Barlines"));
      sp->setMag(0.8);
      sp->setGrid(42, 38);

      // bar line styles
      struct {
            BarLineType type;
            const char* name;
            } t[] = {
            { NORMAL_BAR,       QT_TR_NOOP("Normal") },
            { BROKEN_BAR,       QT_TR_NOOP("Dashed") },
            { DOTTED_BAR,       QT_TR_NOOP("Dotted") },
            { END_BAR,          QT_TR_NOOP("End Bar") },
            { DOUBLE_BAR,       QT_TR_NOOP("Double Bar") },
            { START_REPEAT,     QT_TR_NOOP("Start Repeat") },
            { END_REPEAT,       QT_TR_NOOP("End Repeat") },
            { END_START_REPEAT, QT_TR_NOOP("End-Start Repeat") },
            };
      for (unsigned i = 0; i < sizeof(t)/sizeof(*t); ++i) {
            BarLine* b  = new BarLine(gscore);
            b->setSubtype(t[i].type);
            sp->append(b, qApp->translate("barlines", t[i].name));
            }

      // bar line spans
      struct {
            int         from, to;
            const char* name;
            } span[] = {
            { -1, 1, QT_TR_NOOP("Tick 1") },
            { -2, 2, QT_TR_NOOP("Tick 2") },
            { 2,  6, QT_TR_NOOP("Short 1") },
            { 1,  7, QT_TR_NOOP("Short 2") },
            };
      for (unsigned i = 0; i < sizeof(span)/sizeof(*span); ++i) {
            BarLine* b  = new BarLine(gscore);
            b->setSubtype(NORMAL_BAR);
            b->setSpanFrom(span[i].from);
            b->setSpanTo(span[i].to);
            sp->append(b, qApp->translate("barlines", span[i].name));
            }
      return sp;
      }
开发者ID:aeliot,项目名称:MuseScore,代码行数:46,代码来源:menus.cpp

示例3: newBarLinePalette

Palette* MuseScore::newBarLinePalette(bool basic)
      {
      Palette* sp = new Palette;
      sp->setName(QT_TRANSLATE_NOOP("Palette", "Barlines"));
      sp->setMag(0.8);
      sp->setGrid(42, 38);

      // bar line styles
      for (unsigned i = 0; i < BarLine::barLineTableSize(); ++i) {
            BarLine* b  = new BarLine(gscore);
            BarLineTableItem bti = BarLine::barLineTableItem(i);
            b->setBarLineType(bti.type);
            sp->append(b, qApp->translate("Palette", bti.name));
            }

      if (!basic) {
      // bar line spans
            struct {
                  int         from, to;
                  const char* name;
                  } span[] = {
                  { BARLINE_SPAN_TICK1_FROM, BARLINE_SPAN_TICK1_TO, QT_TRANSLATE_NOOP("Palette", "Tick 1 span") },
                  { BARLINE_SPAN_TICK2_FROM, BARLINE_SPAN_TICK2_TO, QT_TRANSLATE_NOOP("Palette", "Tick 2 span") },
                  { BARLINE_SPAN_SHORT1_FROM,BARLINE_SPAN_SHORT1_TO,QT_TRANSLATE_NOOP("Palette", "Short 1 span") },
                  { BARLINE_SPAN_SHORT2_FROM,BARLINE_SPAN_SHORT2_TO,QT_TRANSLATE_NOOP("Palette", "Short 2 span") },
                  };
            for (unsigned i = 0; i < sizeof(span)/sizeof(*span); ++i) {
                  BarLine* b  = new BarLine(gscore);
                  b->setBarLineType(BarLineType::NORMAL);
                  b->setSpanFrom(span[i].from);
                  b->setSpanTo(span[i].to);
                  sp->append(b, qApp->translate("Palette", span[i].name));
                  }
            }
      return sp;
      }
开发者ID:silongzhou,项目名称:MuseScore,代码行数:36,代码来源:menus.cpp

示例4: draw

void ContinuousPanel::draw(QPainter& painter, const QList<Element*>& el) {
      painter.save();
      painter.setRenderHint(QPainter::Antialiasing, preferences.antialiasedDrawing);
      painter.setRenderHint(QPainter::TextAntialiasing, true);

      // Draw colored rectangle
      painter.setClipping(false);
      QPointF pos(_offsetPanel, 0);
      painter.translate(pos);
      QPen pen;
      pen.setWidthF(0.0);
      pen.setStyle(Qt::NoPen);
      painter.setPen(pen);
      painter.setBrush(preferences.fgColor);
      QRectF bg(_rect);
      bg.setWidth(_widthClef + _widthKeySig + _widthTimeSig + _leftMarginTotal + _panelRightPadding);
      QPixmap* fgPixmap = _sv->fgPixmap();
      if (fgPixmap == 0 || fgPixmap->isNull())
            painter.fillRect(bg, preferences.fgColor);
      else {
            painter.setMatrixEnabled(false);
            painter.drawTiledPixmap(bg, *fgPixmap, bg.topLeft()
               - QPoint(lrint(_sv->matrix().dx()), lrint(_sv->matrix().dy())));
            painter.setMatrixEnabled(true);
            }

      painter.setClipRect(_rect);
      painter.setClipping(true);

      QColor color(MScore::layoutBreakColor);

      // Draw measure text number
      QString text = _mmRestCount ? QString("#%1-%2").arg(_currentMeasureNo+1).arg(_currentMeasureNo+_mmRestCount) : QString("#%1").arg(_currentMeasureNo+1);
      Text* newElement = new Text(_score);
      newElement->setTextStyleType(TextStyleType::DEFAULT);
      newElement->setFlag(ElementFlag::MOVABLE, false);
      newElement->setXmlText(text);
      newElement->textStyle().setFamily("FreeSans");
      newElement->textStyle().setSizeIsSpatiumDependent(true);
      newElement->setColor(color);
      newElement->sameLayout();
      pos = QPointF(_score->styleP(StyleIdx::clefLeftMargin) + _widthClef, _y + newElement->height());
      painter.translate(pos);
      newElement->draw(&painter);
      pos += QPointF(_offsetPanel, 0);
      painter.translate(-pos);
      delete newElement;

      // This second pass draws the elements spaced evently using the width of the largest element
      for (const Element* e : el) {
            e->itemDiscovered = 0;
            if (!e->visible()) {
                  if (_score->printing() || !_score->showInvisible())
                        continue;
                  }

           if (e->type() == Element::Type::STAFF_LINES) {
                  Staff* currentStaff = _score->staff(e->staffIdx());
                  Segment* parent = _score->tick2segmentMM(_currentMeasureTick);

                  pos = QPointF (_offsetPanel, e->pagePos().y());
                  painter.translate(pos);

                  // Draw staff lines
                  StaffLines* newStaffLines = static_cast<StaffLines*>(e->clone());
                  newStaffLines->setWidth(bg.width());
                  newStaffLines->setParent(parent);
                  newStaffLines->setTrack(e->track());
                  newStaffLines->layout();
                  newStaffLines->setColor(color);
                  newStaffLines->draw(&painter);
                  delete newStaffLines;

                  // Draw barline
                  BarLine* newBarLine = new BarLine(_score);
                  newBarLine->setBarLineType(BarLineType::NORMAL);
                  newBarLine->setParent(parent);
                  newBarLine->setTrack(e->track());
                  newBarLine->setSpan(currentStaff->barLineSpan());
                  newBarLine->setSpanFrom(currentStaff->barLineFrom());
                  newBarLine->setSpanTo(currentStaff->barLineTo());
                  newBarLine->layout();
                  newBarLine->setColor(color);
                  newBarLine->draw(&painter);
                  delete newBarLine;

                  // Draw the current staff name
                  QList<StaffName>& staffNamesLong = currentStaff->part()->instrument()->longNames();
                  QString staffName = staffNamesLong.isEmpty() ? " " : staffNamesLong[0].name();
                  if (staffName == "") {
                        QList<StaffName>& staffNamesShort = currentStaff->part()->instrument()->shortNames();
                        staffName = staffNamesShort.isEmpty() ? "" : staffNamesShort[0].name();
                        }

                  Text* newName = new Text(_score);
                  newName->setXmlText(staffName);
                  newName->setParent(parent);
                  newName->setTrack(e->track());
                  newName->setColor(color);
                  newName->textStyle().setFamily("FreeSans");
//.........这里部分代码省略.........
开发者ID:konri9,项目名称:MuseScore,代码行数:101,代码来源:continuouspanel.cpp


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