本文整理汇总了C++中Bracket::setSpan方法的典型用法代码示例。如果您正苦于以下问题:C++ Bracket::setSpan方法的具体用法?C++ Bracket::setSpan怎么用?C++ Bracket::setSpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bracket
的用法示例。
在下文中一共展示了Bracket::setSpan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drop
Element* Bracket::drop(const DropData& data)
{
Element* e = data.element;
if (e->type() == BRACKET) {
Bracket* b = static_cast<Bracket*>(e);
b->setParent(parent());
b->setTrack(track());
b->setSpan(span());
b->setLevel(level());
score()->undoRemoveElement(this);
score()->undoAddElement(b);
return b;
}
delete e;
return 0;
}
示例2: layoutSystem
void System::layoutSystem(qreal xo1)
{
if (_staves.empty()) // ignore vbox
return;
static const Spatium instrumentNameOffset(1.0); // TODO: make style value
int nstaves = _staves.size();
//---------------------------------------------------
// find x position of staves
// create brackets
//---------------------------------------------------
qreal xoff2 = 0.0; // x offset for instrument name
int bracketLevels = 0;
for (int idx = 0; idx < nstaves; ++idx)
bracketLevels = qMax(bracketLevels, score()->staff(idx)->bracketLevels());
qreal bracketWidth[bracketLevels];
for (int i = 0; i < bracketLevels; ++i)
bracketWidth[i] = 0.0;
QList<Bracket*> bl;
bl.swap(_brackets);
for (int staffIdx = 0; staffIdx < nstaves; ++staffIdx) {
Staff* s = score()->staff(staffIdx);
for (int i = 0; i < bracketLevels; ++i) {
if (s->bracket(i) == BracketType::NO_BRACKET)
continue;
int firstStaff = staffIdx;
int lastStaff = staffIdx + s->bracketSpan(i) - 1;
if (lastStaff >= nstaves)
lastStaff = nstaves - 1;
for (; firstStaff <= lastStaff; ++firstStaff) {
if (score()->staff(firstStaff)->show())
break;
}
for (; lastStaff >= firstStaff; --lastStaff) {
if (score()->staff(lastStaff)->show())
break;
}
int span = lastStaff - firstStaff + 1;
//
// do not show bracket if it only spans one
// system due to some invisible staves
//
if ((span > 1) || (s->bracketSpan(i) == span)) {
//
// this bracket is visible
//
Bracket* b = 0;
int track = staffIdx * VOICES;
for (int k = 0; k < bl.size(); ++k) {
if (bl[k]->track() == track && bl[k]->level() == i) {
b = bl.takeAt(k);
break;
}
}
if (b == 0) {
b = new Bracket(score());
b->setGenerated(true);
b->setTrack(track);
b->setLevel(i);
}
add(b);
b->setFirstStaff(firstStaff);
b->setLastStaff(lastStaff);
b->setBracketType(s->bracket(i));
b->setSpan(s->bracketSpan(i));
bracketWidth[i] = qMax(bracketWidth[i], b->width());
}
}
if (!s->show())
continue;
for (InstrumentName* t : _staves[staffIdx]->instrumentNames) {
t->layout();
qreal w = t->width() + point(instrumentNameOffset);
if (w > xoff2)
xoff2 = w;
}
}
for (Bracket* b : bl)
delete b;
//---------------------------------------------------
// layout SysStaff and StaffLines
//---------------------------------------------------
_leftMargin = xoff2;
qreal bd = score()->styleP(StyleIdx::bracketDistance);
if ( _brackets.size() > 0) {
for (int i = 0; i < bracketLevels; ++i)
_leftMargin += bracketWidth[i] + bd;
//.........这里部分代码省略.........