本文整理汇总了C++中LayoutBreak::setParent方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBreak::setParent方法的具体用法?C++ LayoutBreak::setParent怎么用?C++ LayoutBreak::setParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBreak
的用法示例。
在下文中一共展示了LayoutBreak::setParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undoSetBreak
void MeasureBase::undoSetBreak(bool v, LayoutBreak::Type type)
{
switch (type) {
case LayoutBreak::LINE:
if (lineBreak() == v)
return;
setLineBreak(v);
break;
case LayoutBreak::PAGE:
if (pageBreak() == v)
return;
if (v && lineBreak())
setLineBreak(false);
setPageBreak(v);
break;
case LayoutBreak::SECTION:
if (sectionBreak() == v)
return;
if (v && lineBreak())
setLineBreak(false);
setSectionBreak(v);
break;
case LayoutBreak::NOBREAK:
if (noBreak() == v)
return;
if (v) {
setLineBreak(false);
setPageBreak(false);
setSectionBreak(false);
}
setNoBreak(v);
break;
}
if (v) {
LayoutBreak* lb = new LayoutBreak(score());
lb->setLayoutBreakType(type);
lb->setTrack(-1); // this are system elements
lb->setParent(this);
score()->undoAddElement(lb);
}
cleanupLayoutBreaks(true);
}
示例2: readScore
void TestBarline::barline05()
{
Score* score = readScore(DIR + "barline05.mscx");
QVERIFY(score);
score->doLayout();
// 'go' to 4th measure
Measure* msr = score->firstMeasure();
for (int i=0; i < 3; i++)
msr = msr->nextMeasure();
// create and add a LineBreak element
LayoutBreak* lb = new LayoutBreak(score);
lb->setLayoutBreakType(LayoutBreak::Type::LINE);
lb->setTrack(-1); // system-level element
lb->setParent(msr);
score->undoAddElement(lb);
score->doLayout();
// check an end-repeat bar line has been created at the end of this measure and it is generated
Segment* seg = msr->findSegment(SegmentType::EndBarLine, msr->tick()+msr->ticks());
QVERIFY2(seg != nullptr, "No SegEndBarLine segment in measure 4.");
BarLine* bar = static_cast<BarLine*>(seg->element(0));
QVERIFY2(bar != nullptr, "No end-repeat barline in measure 4.");
QVERIFY2(bar->barLineType() == BarLineType::END_REPEAT, "Barline at measure 4 is not END-REPEAT");
QVERIFY2(bar->generated(), "End-repeat barline in measure 4 is non-generated.");
// // check an end-repeat bar line has been created at the beginning of the next measure and it is not generated
// check an end-repeat bar line has been created at the beginning of the next measure and it is generated
msr = msr->nextMeasure();
seg = msr->findSegment(SegmentType::StartRepeatBarLine, msr->tick());
QVERIFY2(seg != nullptr, "No SegStartRepeatBarLine segment in measure 5.");
bar = static_cast<BarLine*>(seg->element(0));
QVERIFY2(bar != nullptr, "No start-repeat barline in measure 5.");
QVERIFY2(bar->generated(), "Start-reapeat barline in measure 5 is not generated.");
// QVERIFY(saveCompareScore(score, "barline05.mscx", DIR + "barline05-ref.mscx"));
delete score;
}
示例3: drop
Element* Box::drop(const DropData& data)
{
Element* e = data.element;
switch(e->type()) {
case LAYOUT_BREAK:
{
LayoutBreak* lb = static_cast<LayoutBreak*>(e);
if (_pageBreak || _lineBreak) {
if (
(lb->subtype() == LAYOUT_BREAK_PAGE && _pageBreak)
|| (lb->subtype() == LAYOUT_BREAK_LINE && _lineBreak)
|| (lb->subtype() == LAYOUT_BREAK_SECTION && _sectionBreak)
) {
//
// if break already set
//
delete lb;
break;
}
foreach(Element* elem, _el) {
if (elem->type() == LAYOUT_BREAK) {
score()->undoChangeElement(elem, e);
break;
}
}
break;
}
lb->setTrack(-1); // this are system elements
lb->setParent(this);
score()->undoAddElement(lb);
return lb;
}
case STAFF_TEXT:
{
Text* text = new Text(score());
text->setTextStyle(score()->textStyle(TEXT_STYLE_FRAME));
text->setParent(this);
text->setHtml(static_cast<StaffText*>(e)->getHtml());
score()->undoAddElement(text);
delete e;
return text;
}
case ICON:
switch(static_cast<Icon*>(e)->subtype()) {
case ICON_VFRAME:
score()->insertMeasure(VBOX, this);
break;
case ICON_TFRAME:
score()->insertMeasure(TBOX, this);
break;
case ICON_FFRAME:
score()->insertMeasure(FBOX, this);
break;
case ICON_MEASURE:
score()->insertMeasure(MEASURE, this);
break;
}
break;
default:
e->setParent(this);
score()->undoAddElement(e);
return e;
}
return 0;
}
示例4: drop
Element* Box::drop(const DropData& data)
{
Element* e = data.element;
if (e->flag(ElementFlag::ON_STAFF))
return 0;
switch (e->type()) {
case Element::Type::LAYOUT_BREAK:
{
LayoutBreak* lb = static_cast<LayoutBreak*>(e);
if (_pageBreak || _lineBreak) {
if (
(lb->layoutBreakType() == LayoutBreak::Type::PAGE && _pageBreak)
|| (lb->layoutBreakType() == LayoutBreak::Type::LINE && _lineBreak)
|| (lb->layoutBreakType() == LayoutBreak::Type::SECTION && _sectionBreak)
) {
//
// if break already set
//
delete lb;
break;
}
foreach (Element* elem, _el) {
if (elem->type() == Element::Type::LAYOUT_BREAK) {
score()->undoChangeElement(elem, e);
break;
}
}
break;
}
lb->setTrack(-1); // these are system elements
lb->setParent(this);
score()->undoAddElement(lb);
return lb;
}
case Element::Type::STAFF_TEXT:
{
Text* text = new Text(score());
text->setTextStyleType(TextStyleType::FRAME);
text->setParent(this);
text->setXmlText(static_cast<StaffText*>(e)->xmlText());
score()->undoAddElement(text);
delete e;
return text;
}
case Element::Type::ICON:
switch(static_cast<Icon*>(e)->iconType()) {
case IconType::VFRAME:
score()->insertMeasure(Element::Type::VBOX, this);
break;
case IconType::TFRAME:
score()->insertMeasure(Element::Type::TBOX, this);
break;
case IconType::FFRAME:
score()->insertMeasure(Element::Type::FBOX, this);
break;
case IconType::MEASURE:
score()->insertMeasure(Element::Type::MEASURE, this);
break;
default:
break;
}
break;
case Element::Type::TEXT:
case Element::Type::IMAGE:
case Element::Type::SYMBOL:
e->setParent(this);
score()->undoAddElement(e);
return e;
default:
return 0;
}
return 0;
}