本文整理汇总了C++中QWebElement::addClass方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebElement::addClass方法的具体用法?C++ QWebElement::addClass怎么用?C++ QWebElement::addClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebElement
的用法示例。
在下文中一共展示了QWebElement::addClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void tdRenderer::render(QByteArray ba)
{
bufreset(m_buffer);
QWebElement element = m_body.findFirst(".__tmp__");
const char *data = ba.data();
uint beg = 0;
size_t e = ba.size();
int prevsize = 0;
int pos = m_fframe;
while (beg < e) {
const char *offs = data + beg;
int n = td_markdown_render(m_buffer, (const uint8_t *) offs,
e - beg, m_markdown);
QByteArray bytes((const char *) m_buffer->data + prevsize, m_buffer->size - prevsize);
m_sizes.insert(pos, n);
m_indices.insert(pos++, m_index);
if (m_pants) {
bufreset(m_tmpbuffer);
sdhtml_smartypants(m_tmpbuffer, (const uint8_t *) bytes.constData(), bytes.size());
QByteArray pants((const char *) m_tmpbuffer->data, m_tmpbuffer->size);
element.appendInside(pants);
} else {
element.appendInside(bytes);
}
QWebElementCollection children = element.findAll("*");
QString klassName = "__" % QString::number(m_index++) % "__";
QWebElementCollection::const_iterator i = children.constBegin();
for (; i != children.constEnd(); ++i) {
QWebElement e = *i;
e.addClass(klassName);
if (!e.parent().hasClass(klassName))
element.prependOutside(e.takeFromDocument());
}
if (m_body.findFirst("." % klassName).isNull())
element.prependOutside("<span class=\"" % klassName % "\"></span>");
beg += n;
prevsize = m_buffer->size;
}
element.takeFromDocument();
}
示例2: setNumBlocks
//.........这里部分代码省略.........
if (nNodeMode == NT_FULL)
{
tooltip += "\n"
+ tr("~%n block(s) remaining", "", nRemainingBlocks);
} else
{
char temp[128];
snprintf(temp, sizeof(temp), "~%%n %s remaining", nRemainingBlocks == 1 ? qPrintable(sBlockType) : qPrintable(sBlockTypeMulti));
tooltip += "\n"
+ tr(temp, "", nRemainingBlocks);
};
}
tooltip += (tooltip.isEmpty()? "" : "\n")
+ tr("Downloaded %1 of %2 %3 of transaction history (%4% done).").arg(count).arg(nTotalBlocks).arg(sBlockTypeMulti).arg(nPercentageDone, 0, 'f', 2);
}
else
{
tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
}
// Override progressBarLabel text when we have warnings to display
if (!strStatusBarWarnings.isEmpty())
bridge->networkAlert(strStatusBarWarnings);
QDateTime lastBlockDate;
if (nNodeMode == NT_FULL)
lastBlockDate = clientModel->getLastBlockDate();
else
lastBlockDate = clientModel->getLastBlockThinDate();
int secs = lastBlockDate.secsTo(QDateTime::currentDateTime());
QString text;
// Represent time from last generated block in human readable text
if (secs <= 0)
{
// Fully up to date. Leave text empty.
} else
if (secs < 60)
{
text = tr("%n second(s) ago","",secs);
} else
if (secs < 60*60)
{
text = tr("%n minute(s) ago","",secs/60);
} else
if (secs < 24*60*60)
{
text = tr("%n hour(s) ago","",secs/(60*60));
} else
{
text = tr("%n day(s) ago","",secs/(60*60*24));
}
// Set icon state: spinning if catching up, tick otherwise
if (secs < 90*60 && count >= nTotalBlocks
&& nNodeState != NS_GET_FILTERED_BLOCKS)
{
tooltip = tr("Up to date") + "\n" + tooltip;
blocksIcon.removeClass("none");
syncingIcon.addClass("none");
QWebElementCollection outOfSyncElements = documentFrame->findAllElements(".outofsync");
foreach(QWebElement outOfSync, outOfSyncElements)
outOfSync.setStyleProperty("display", "none");
syncProgressBar.setAttribute("style", "display:none;");
}
else
{
tooltip = tr("Catching up...") + "\n" + tooltip;
blocksIcon.addClass("none");
syncingIcon.removeClass("none");
QWebElementCollection outOfSyncElements = documentFrame->findAllElements(".outofsync");
foreach(QWebElement outOfSync, outOfSyncElements)
outOfSync.setStyleProperty("display", "inline");
syncProgressBar.removeAttribute("style");
}
if (!text.isEmpty())
{
tooltip += "\n";
tooltip += tr("Last received %1 was generated %2.").arg(sBlockType).arg(text);
};
blocksIcon .setAttribute("title", tooltip);
syncingIcon .setAttribute("title", tooltip);
syncProgressBar.setAttribute("title", tooltip);
syncProgressBar.setAttribute("value", QString::number(count));
syncProgressBar.setAttribute("max", QString::number(nTotalBlocks));
}