本文整理汇总了C++中QWebElement::setPlainText方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebElement::setPlainText方法的具体用法?C++ QWebElement::setPlainText怎么用?C++ QWebElement::setPlainText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebElement
的用法示例。
在下文中一共展示了QWebElement::setPlainText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_fBtnRefresh_clicked
void QwcNewsWidget::on_fBtnRefresh_clicked()
{
QWebElement newsItemsElement = newsView->page()->mainFrame()->findFirstElement("#news_items");
newsItemsElement.setPlainText(QString());
m_newsCounter = 0;
m_socket->getNews();
pageWidget->setCurrentIndex(1);
}
示例2: updateNewsCss
/*! Clear the contents of the news view and set an empty HTML page with styles.
*/
void QwcNewsWidget::updateNewsCss()
{
QSettings settings;
QFont newsFont;
newsFont.fromString(settings.value("interface/news/font", QFont().toString()).toString());
composeMessage->setFont(newsFont);
QWebElement styleElement = newsView->page()->mainFrame()->findFirstElement("#css_block");
styleElement.setPlainText(QString("body { %1 }").arg(QwcMessageStyle::cssFromFont(newsFont)));
}
示例3: sendReportUsingGitreport
/**
* @fn sendReportUsingGitreport
*/
void GitreportModule::sendReportUsingGitreport(const QMap<QString, QString> info)
{
if (debug) qDebug() << "[GitreportModule]" << "[sendReportUsingGitreport]";
QWebElement document = webView->page()->mainFrame()->documentElement();
QWebElement captchaKey = document.findFirst(QString("input#captcha"));
QWebElement emailInput = document.findFirst(QString("input#email"));
QWebElement textArea = document.findFirst(QString("textarea#details"));
QWebElement usernameInput = document.findFirst(QString("input#name"));
// input
usernameInput.setAttribute(QString("value"), info[QString("username")]);
emailInput.setAttribute(QString("value"), info[QString("password")]);
textArea.setPlainText(info[QString("body")]);
captchaKey.setAttribute(QString("value"), info[QString("captcha")]);
// send request
document.findFirst(QString("input[name=commit]")).evaluateJavaScript("this.click()");
disconnect(webView, SIGNAL(loadFinished(bool)), this, SLOT(gitreportLoaded(bool)));
disconnect(webView, SIGNAL(loadFinished(bool)), this, SLOT(gitreportFinished(bool)));
connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(gitreportFinished(bool)));
}
示例4: updateFileMessage
void lmcMessageLog::updateFileMessage(FileMode mode, FileOp op, QString fileId) {
QString szMessage = getFileStatusMessage(mode, op);
QWebFrame* frame = page()->mainFrame();
QWebElement document = frame->documentElement();
QWebElement body = document.findFirst("body");
QString selector = "span#";
QString tempId = (mode == FM_Send) ? "send" : "receive";
tempId.append(fileId);
selector.append(tempId);
QWebElement span = body.findFirst(selector);
span.setPlainText(szMessage);
// update the entry in message log
for(int index = 0; index < messageLog.count(); index++) {
SingleMessage msg = messageLog.at(index);
if(tempId.compare(msg.id) == 0) {
XmlMessage xmlMessage = msg.message;
xmlMessage.removeData(XN_FILEOP);
xmlMessage.addData(XN_FILEOP, FileOpNames[op]);
msg.message = xmlMessage;
break;
}
}
}
示例5: modifyImageTags
/* Modify an image tag. Basically we turn it back into a picture, write out the file, and
modify the ENML */
void NoteFormatter::modifyImageTags(QWebElement &enMedia, QString &hash) {
QString mimetype = enMedia.attribute("type");
qint32 resLid = 0;
resLid = hashMap[hash];
QString highlightString = "";
if (resLid>0) {
QLOG_TRACE() << "Getting resource";
Resource r = resourceMap[resLid];
QLOG_TRACE() << "resource retrieved";
MimeReference ref;
QString filename;
ResourceAttributes attributes;
if (r.attributes.isSet())
attributes = r.attributes;
if (attributes.fileName.isSet())
filename = attributes.fileName;
QString type = ref.getExtensionFromMime(mimetype, filename);
Data data;
if (r.data.isSet())
data = r.data;
if (data.size.isSet() && data.size > 0) {
QString imgfile = "file:///"+global.fileManager.getDbDirPath(QString("dba/") +QString::number(resLid) +type);
enMedia.setAttribute("src", imgfile);
// Check if this is a LaTeX image
ResourceAttributes attributes;
if (r.attributes.isSet())
attributes = r.attributes;
QString sourceUrl = "";
if (attributes.sourceURL.isSet())
sourceUrl = attributes.sourceURL;
if (sourceUrl.toLower().startsWith("http://latex.codecogs.com/gif.latex?")) {
enMedia.appendInside("<img/>");
QWebElement newText = enMedia.lastChild();
enMedia.setAttribute("en-tag", "en-latex");
newText.setAttribute("onMouseOver", "style.cursor='pointer'");
newText.setAttribute("title", sourceUrl);
newText.setAttribute("href", "latex://"+QString::number(resLid));
}
enMedia.setAttribute("onContextMenu", "window.browserWindow.imageContextMenu('"
+QString::number(resLid) +"', '"
+QString::number(resLid) +type +"');");
highlightString = addImageHighlight(resLid, imgfile);
if (highlightString != "")
enMedia.setAttribute("onload", highlightString);
}
} else {
resourceError = true;
readOnly = true;
}
// Reset the tags to something that WebKit will understand
enMedia.setAttribute("en-tag", "en-media");
enMedia.setPlainText("");
enMedia.setAttribute("lid", QString::number(resLid));
// rename the <enmedia> tag to <img>
enMedia.setOuterXml(enMedia.toOuterXml().replace("<en-media","<img"));
enMedia.setOuterXml(enMedia.toOuterXml().replace("</en-media>","</img>"));
}