本文整理汇总了C++中Articulation::anchor方法的典型用法代码示例。如果您正苦于以下问题:C++ Articulation::anchor方法的具体用法?C++ Articulation::anchor怎么用?C++ Articulation::anchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articulation
的用法示例。
在下文中一共展示了Articulation::anchor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void InspectorArticulation::apply()
{
Articulation* a = static_cast<Articulation*>(inspector->element());
Score* score = a->score();
qreal _spatium = score->spatium();
QPointF o(ar.x->value() * _spatium, ar.y->value() * _spatium);
score->startCmd();
if (o != a->pos())
score->undoChangeUserOffset(a, o - a->ipos());
Direction d = Direction(ar.direction->currentIndex());
ArticulationAnchor anchor = ArticulationAnchor(ar.anchor->currentIndex());
if (anchor != a->anchor())
score->undoChangeProperty(a, P_ARTICULATION_ANCHOR, int(anchor));
if (d != a->direction())
score->undoChangeProperty(a, P_DIRECTION, int(d));
score->endCmd();
mscore->endCmd();
}
示例2: setElement
void InspectorArticulation::setElement(Element* e)
{
Articulation* a = static_cast<Articulation*>(e);
qreal _spatium = e->score()->spatium();
ar.elementName->setText(e->name());
ar.x->blockSignals(true);
ar.y->blockSignals(true);
ar.direction->blockSignals(true);
ar.anchor->blockSignals(true);
ar.x->setValue(a->pos().x() / _spatium);
ar.y->setValue(a->pos().y() / _spatium);
ar.direction->setCurrentIndex(int(a->direction()));
ar.anchor->setCurrentIndex(int(a->anchor()));
ar.x->blockSignals(false);
ar.y->blockSignals(false);
ar.direction->blockSignals(false);
ar.anchor->blockSignals(false);
}
示例3: layoutArticulations
//.........这里部分代码省略.........
if (stem) {
qreal y = stem->pos().y() + pos().y();
if (up() && stem->stemLen() < 0.0)
y += stem->stemLen();
else if (!up() && stem->stemLen() > 0.0)
y -= stem->stemLen();
if (beam()) {
qreal bw = score()->styleS(StyleIdx::beamWidth).val() * _spatium;
y += up() ? -bw : bw;
}
if (up())
staffTopY = qMin(staffTopY, qreal(y - 0.5 * _spatium));
else
staffBotY = qMax(staffBotY, qreal(y + 0.5 * _spatium));
}
}
staffTopY = qMin(staffTopY, qreal(chordTopY - distance0 - 0.5 * _spatium));
staffBotY = qMax(staffBotY, qreal(chordBotY + distance0 + 0.5 * _spatium));
qreal dy = 0.0;
int n = _articulations.size();
for (int i = 0; i < n; ++i) {
Articulation* a = _articulations.at(i);
//
// determine MScore::Direction
//
if (a->direction() != MScore::Direction::AUTO) {
a->setUp(a->direction() == MScore::Direction::UP);
}
else {
if (a->anchor() == ArticulationAnchor::CHORD)
a->setUp(!up());
else
a->setUp(a->anchor() == ArticulationAnchor::TOP_STAFF || a->anchor() == ArticulationAnchor::TOP_CHORD);
}
}
//
// pass 1
// place tenuto and staccato
//
for (int i = 0; i < n; ++i) {
Articulation* a = _articulations.at(i);
a->layout();
ArticulationAnchor aa = a->anchor();
if ((a->articulationType() != ArticulationType::Tenuto)
&& (a->articulationType() != ArticulationType::Staccato))
continue;
if (aa != ArticulationAnchor::CHORD && aa != ArticulationAnchor::TOP_CHORD && aa != ArticulationAnchor::BOTTOM_CHORD)
continue;
bool bottom;
if ((aa == ArticulationAnchor::CHORD) && measure()->hasVoices(a->staffIdx()))
bottom = !up();
else
bottom = (aa == ArticulationAnchor::BOTTOM_CHORD) || (aa == ArticulationAnchor::CHORD && up());
bool headSide = bottom == up();
dy += distance1;
qreal y;
示例4: 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));
}
}