本文整理汇总了C++中LayoutBreak::read方法的典型用法代码示例。如果您正苦于以下问题:C++ LayoutBreak::read方法的具体用法?C++ LayoutBreak::read怎么用?C++ LayoutBreak::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayoutBreak
的用法示例。
在下文中一共展示了LayoutBreak::read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void Box::read(const QDomElement& de)
{
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
bool keepMargins = false; // whether original margins have to be kept when reading old file
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
const QString& tag(e.tagName());
const QString& text(e.text());
if (tag == "height")
_boxHeight = Spatium(text.toDouble());
else if (tag == "width")
_boxWidth = Spatium(text.toDouble());
else if (tag == "topGap")
_topGap = text.toDouble();
else if (tag == "bottomGap")
_bottomGap = text.toDouble();
else if (tag == "leftMargin")
_leftMargin = text.toDouble();
else if (tag == "rightMargin")
_rightMargin = text.toDouble();
else if (tag == "topMargin")
_topMargin = text.toDouble();
else if (tag == "bottomMargin")
_bottomMargin = text.toDouble();
else if (tag == "Text") {
Text* t;
if (type() == TBOX) {
t = static_cast<TBox*>(this)->getText();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
add(t);
if (score()->mscVersion() <= 114)
t->setLayoutToParentWidth(true);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
// look ahead for image type
QString path;
QDomElement ee = e.firstChildElement("path");
if (!ee.isNull())
path = ee.text();
Image* image = 0;
QString s(path.toLower());
if (s.endsWith(".svg"))
image = new SvgImage(score());
else
if (s.endsWith(".jpg")
|| s.endsWith(".png")
|| s.endsWith(".gif")
|| s.endsWith(".xpm")
) {
image = new RasterImage(score());
}
else {
qDebug("unknown image format <%s>\n", path.toLatin1().data());
}
if (image) {
image->setTrack(score()->curTrack);
image->read(e);
add(image);
}
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else
domError(e);
}
// with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
// for backward compatibility set them to 0 in all other cases
if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins) {
//.........这里部分代码省略.........
示例2: readProperties
bool MeasureBase::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
bool doAdd = true;
switch (lb->layoutBreakType()) {
case LayoutBreak::LINE:
if (lineBreak())
doAdd = false;
break;
case LayoutBreak::PAGE:
if (pageBreak())
doAdd = false;
break;
case LayoutBreak::SECTION:
if (sectionBreak())
doAdd = false;
break;
case LayoutBreak::NOBREAK:
if (noBreak())
doAdd = false;
break;
}
if (doAdd) {
add(lb);
cleanupLayoutBreaks(false);
}
else
delete lb;
}
else if (tag == "StaffTypeChange") {
StaffTypeChange* stc = new StaffTypeChange(score());
stc->setTrack(e.track());
stc->setParent(this);
stc->read(e);
add(stc);
}
else if (Element::readProperties(e))
;
else
return false;
return true;
}
示例3: read
void Box::read(XmlReader& e)
{
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
bool keepMargins = false; // whether original margins have to be kept when reading old file
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "height")
_boxHeight = Spatium(e.readDouble());
else if (tag == "width")
_boxWidth = Spatium(e.readDouble());
else if (tag == "topGap")
_topGap = e.readDouble();
else if (tag == "bottomGap")
_bottomGap = e.readDouble();
else if (tag == "leftMargin")
_leftMargin = e.readDouble();
else if (tag == "rightMargin")
_rightMargin = e.readDouble();
else if (tag == "topMargin")
_topMargin = e.readDouble();
else if (tag == "bottomMargin")
_bottomMargin = e.readDouble();
else if (tag == "Text") {
Text* t;
if (type() == TBOX) {
t = static_cast<TBox*>(this)->getText();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
add(t);
if (score()->mscVersion() <= 114)
t->setLayoutToParentWidth(true);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
Image* image = new Image(score());
image->setTrack(e.track());
image->read(e);
add(image);
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (Element::readProperties(e))
;
else
e.unknown();
}
// with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
// for backward compatibility set them to 0 in all other cases
if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins) {
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
}
}
示例4: readProperties
bool Box::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "height")
_boxHeight = Spatium(e.readDouble());
else if (tag == "width")
_boxWidth = Spatium(e.readDouble());
else if (tag == "topGap") {
_topGap = e.readDouble();
if (score()->mscVersion() >= 203)
_topGap *= score()->spatium();
}
else if (tag == "bottomGap") {
_bottomGap = e.readDouble();
if (score()->mscVersion() >= 203)
_bottomGap *= score()->spatium();
}
else if (tag == "leftMargin")
_leftMargin = e.readDouble();
else if (tag == "rightMargin")
_rightMargin = e.readDouble();
else if (tag == "topMargin")
_topMargin = e.readDouble();
else if (tag == "bottomMargin")
_bottomMargin = e.readDouble();
else if (tag == "Text") {
Text* t;
if (type() == Element::Type::TBOX) {
t = static_cast<TBox*>(this)->text();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
if (t->isEmpty()) {
qDebug("read empty text");
}
else
add(t);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
if (MScore::noImages)
e.skipCurrentElement();
else {
Image* image = new Image(score());
image->setTrack(e.track());
image->read(e);
add(image);
}
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
}
else if (Element::readProperties(e))
;
else
return false;
return true;
}