本文整理汇总了C++中dom::Element::lastChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::lastChild方法的具体用法?C++ Element::lastChild怎么用?C++ Element::lastChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dom::Element
的用法示例。
在下文中一共展示了Element::lastChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMove
//.........这里部分代码省略.........
var_el.appendChild(parent);
var_el.appendChild(document.createTextNode("] "));
prev_cm.parentNode().insertBefore(var_el, add_before);
if(!add_before.isNull() && add_before.getAttribute("id").string().startsWith("mv_")) {
int mv_num = add_before.getAttribute("mvnum").string().toInt();
int sub_mv_num = add_before.getAttribute("submvnum").string().toInt();
QString num_str;
if(m_layout_style == 0) {
if(mv_num%2)
num_str = QString("%1. ").arg((mv_num+1)/2);
else
num_str = QString("%1. ... ").arg((mv_num+2)/2);
}
else {
if(sub_mv_num==0)
num_str = QString("%1. ").arg(mv_num);
else
num_str = QString("%1+%2. ").arg(mv_num).arg(sub_mv_num);
}
DOM::Element num_el = document.createElement("a");
num_el.setAttribute("class", "mvnum");
num_el.setAttribute("id", "nm_"+istr);
num_el.appendChild(document.createTextNode(num_str));
prev_cm.parentNode().insertBefore(num_el, add_before);
}
}
else {
Index pi = index.prev(index.nested.back().num_moves);
parent = document.getElementById("vr_"+pi);
if(parent.isNull()) {
kDebug() << " --> Error in Textual::setMove, no variation?!?!?";
return;
}
}
if(mv_num>0 && ((sub_mv_num==0 && (mv_num%2 || m_layout_style)) || parent.lastChild() != prev_cm) ) {
QString num_str;
if(m_layout_style == 0) {
if(mv_num%2)
num_str = QString("%1. ").arg((mv_num+1)/2);
else
num_str = QString("%1. ... ").arg((mv_num+2)/2);
}
else {
if(sub_mv_num==0)
num_str = QString("%1. ").arg(mv_num);
else
num_str = QString("%1+%2. ").arg(mv_num).arg(sub_mv_num);
}
DOM::Element num_el = document.createElement("a");
num_el.setAttribute("class", "mvnum");
num_el.setAttribute("id", "nm_"+istr);
num_el.appendChild(document.createTextNode(num_str));
parent.appendChild(num_el);
}
DOM::Element mv_el = document.createElement("a");
mv_el.setAttribute("id", "mv_"+istr);
mv_el.setAttribute("href", "index://"+istr);
mv_el.setAttribute("class", "move");
mv_el.setAttribute("turn", QString::number(turn));
mv_el.setAttribute("mvnum", QString::number(mv_num));
mv_el.setAttribute("submvnum", QString::number(sub_mv_num));
for(int i=0;i<move.size();i++) {
if(move[i].m_type == MovePart::Figurine) {
::Loader::Glyph g = m_loader.getValue< ::Loader::Glyph>(move[i].m_string);
DOM::Element el = document.createElement("span");
#if 1
kDebug() << "size = " << QString("%1%").arg(g.m_font.pointSize()*100/12);
el.style().setProperty("font-size", QString("%1%").arg(g.m_font.pointSize()*100/12), "important");
el.style().setProperty("line-height", QString("%1%").arg(g.m_font.pointSize()*100/12), "important");
#endif
kDebug() << "familiy = " << g.m_font.family();
el.style().setProperty("font-weight", "normal", "important");
el.style().setProperty("font-family", g.m_font.family(), "important");
DOM::Text t = document.createTextNode(QString(g.m_char));
el.appendChild(t);
mv_el.appendChild(el);
}
else {
DOM::Text t = document.createTextNode(move[i].m_string);
mv_el.appendChild(t);
}
}
parent.appendChild(mv_el);
parent.appendChild(document.createTextNode(QString(" ")));
DOM::Element cm_el = document.createElement("span");
cm_el.setAttribute("id", "cm_"+istr);
cm_el.setAttribute("class", "comment");
if(!comment.isEmpty()) {
cm_el.appendChild(document.createTextNode(comment));
cm_el.appendChild(document.createTextNode(QString(" ")));
}
//cm_el.setContentEditable(true);
parent.appendChild(cm_el);
}