当前位置: 首页>>代码示例>>C++>>正文


C++ QWebElement::appendInside方法代码示例

本文整理汇总了C++中QWebElement::appendInside方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebElement::appendInside方法的具体用法?C++ QWebElement::appendInside怎么用?C++ QWebElement::appendInside使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWebElement的用法示例。


在下文中一共展示了QWebElement::appendInside方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addNewsItem

void QwcNewsWidget::addNewsItem(const QString &nickname, QDateTime time, const QString &text,
                                bool insertAtTop)
{
    QString messageText = text.trimmed();
    messageText = Qt::escape(messageText);
    messageText = QwcMessageStyle::replaceEmoticons(messageText, m_emoticonsEnabled);
    messageText.replace("\n", "<br>");

    QString newItem = QString("<div class=\"news_item\">"
                              "<span class=\"news_header\">From %1 (%2):</span>"
                              "<span class=\"news_body\">%3</span></div>")
                      .arg(Qt::escape(nickname))
                      .arg(Qt::escape(time.toString()))
                      .arg(messageText);

    QWebElement mainElement = newsView->page()->mainFrame()->findFirstElement("#news_items");
    if (insertAtTop) {
        mainElement.prependInside(newItem);
    } else {
        mainElement.appendInside(newItem);
    }

    m_newsCounter++;
    fNewsStatus->setText(tr("%1 news article(s)").arg(m_newsCounter));
}
开发者ID:pcjpnet,项目名称:qwired-suite,代码行数:25,代码来源:QwcNewsWidget.cpp

示例2: 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();
}
开发者ID:johanneshilden,项目名称:lessedit,代码行数:47,代码来源:renderer.cpp

示例3: initialize

void PhysiomeModelRepositoryWindowWidget::initialize(const PhysiomeModelRepositoryWindowExposures &pExposures,
                                                     const QString &pErrorMessage,
                                                     const bool &pInternetConnectionAvailable)
{
    // Initialise / keep track of some properties

    mExposureNames = QStringList();
    mExposureDisplayed = QBoolList();
    mExposureUrlId = QMap<QString, int>();

    mErrorMessage = pErrorMessage;

    mInternetConnectionAvailable = pInternetConnectionAvailable;

    // Initialise our list of exposures

    QWebElement tbodyElement = page()->mainFrame()->documentElement().findFirst("tbody[id=exposures]");

    tbodyElement.removeAllChildren();

    for (int i = 0, iMax = pExposures.count(); i < iMax; ++i) {
        QString exposureUrl = pExposures[i].url();
        QString exposureName = pExposures[i].name();

        tbodyElement.appendInside("<tr id=\"exposure_"+QString::number(i)+"\">\n"
                                  "    <td class=\"exposure\">\n"
                                  "        <table class=\"fullWidth\">\n"
                                  "            <tbody>\n"
                                  "                <tr>\n"
                                  "                    <td class=\"fullWidth\">\n"
                                  "                        <ul>\n"
                                  "                            <li class=\"exposure\">\n"
                                  "                                <a href=\""+exposureUrl+"\">"+exposureName+"</a>\n"
                                  "                            </li>\n"
                                  "                        </ul>\n"
                                  "                    </td>\n"
                                  "                    <td class=\"button\">\n"
                                  "                        <a class=\"noHover\" href=\"cloneWorkspace|"+exposureUrl+"|"+exposureName+"\"><img class=\"button clone\"/></a>\n"
                                  "                    </td>\n"
                                  "                    <td class=\"button\">\n"
                                  "                        <a class=\"noHover\" href=\"showExposureFiles|"+exposureUrl+"|"+exposureName+"\"><img id=\"exposure_"+QString::number(i)+"\" class=\"button open\"/></a>\n"
                                  "                    </td>\n"
                                  "                </tr>\n"
                                  "            </tbody>\n"
                                  "        </table>\n"
                                  "        <ul id=\"exposureFiles_"+QString::number(i)+"\" style=\"display: none;\">\n"
                                  "        </ul>\n"
                                  "    </td>\n"
                                  "</tr>\n");

        mExposureNames << exposureName;
        mExposureDisplayed << true;
        mExposureUrlId.insert(exposureUrl, i);
    }
}
开发者ID:hsorby,项目名称:opencor,代码行数:55,代码来源:physiomemodelrepositorywindowwidget.cpp

示例4: addExposureFiles

void PhysiomeModelRepositoryWindowWidget::addExposureFiles(const QString &pUrl,
        const QStringList &pExposureFiles)
{
    // Add the given exposure files to the exposure

    QWebElement ulElement = page()->mainFrame()->documentElement().findFirst(QString("ul[id=exposureFiles_%1]").arg(mExposureUrlId.value(pUrl)));

    foreach (const QString &exposureFile, pExposureFiles) {
        ulElement.appendInside(QString("<li class=\"exposureFile\">"
                                       "    <a href=\"%1\">%2</a>"
                                       "</li>").arg(exposureFile, QString(exposureFile).remove(QRegularExpression(".*/"))));
    }
开发者ID:Fairly,项目名称:opencor,代码行数:12,代码来源:physiomemodelrepositorywindowwidget.cpp

示例5: appendPublicMessage

void lmcMessageLog::appendPublicMessage(QString* lpszUserId, QString* lpszUserName, QString* lpszMessage,
										QDateTime *pTime, QFont *pFont, QColor *pColor) {
	QString html = QString::null;
	bool localUser = (lpszUserId->compare(localId) == 0);

	decodeMessage(lpszMessage);

	QString fontStyle = getFontStyle(pFont, pColor, localUser);

	if(lpszUserId->compare(lastId) != 0) {
		outStyle = !outStyle;
		html = outStyle ? themeData.outMsg : themeData.inMsg;

		//	get the avatar image for this user from the cache folder
		QString filePath = participantAvatars.value(*lpszUserId);
		//	if image not found, use the default avatar image for this user
		QString iconPath = QFile::exists(filePath) ? QUrl::fromLocalFile(filePath).toString() : "qrc"AVT_DEFAULT;

		html.replace("%iconpath%", iconPath);
		html.replace("%sender%", *lpszUserName);
		html.replace("%time%", getTimeString(pTime));
		html.replace("%style%", fontStyle);
		html.replace("%message%", *lpszMessage);

		QWebFrame* frame = page()->mainFrame();
		QWebElement document = frame->documentElement();
		QWebElement body = document.findFirst("body");
		body.appendInside(html);
	} else {
		html = outStyle ? themeData.outNextMsg : themeData.inNextMsg;
		html.replace("%time%", getTimeString(pTime));
		html.replace("%style%", fontStyle);
		html.replace("%message%", *lpszMessage);

		QWebFrame* frame = page()->mainFrame();
		QWebElement document = frame->documentElement();
		QWebElement body = document.findFirst("body");
		QWebElement last = body.lastChild();
		QWebElement insert = last.findFirst("div#insert");
		insert.replace(html);
	}

	hasData = true;
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:44,代码来源:messagelog.cpp

示例6: SetData

			void KinotifyWidget::SetData ()
			{
				QString data = Theme_;
				data.replace ("{title}", Title_);
				data.replace ("{body}", Body_);
				if (OverridePixmap_.isNull ())
					data.replace ("{imagepath}", MakeImage (ImagePath_));
				else
					data.replace ("{imagepath}", MakeImage (OverridePixmap_));
				setHtml (data);

				if (!ActionsNames_.isEmpty ())
				{
					QWebElement button = page ()->mainFrame ()->documentElement ().findFirst ("form");
					if (!button.isNull ())
					{
						QStringList reversed = ActionsNames_;
						std::reverse (reversed.begin (), reversed.end ());
						Q_FOREACH (const QString& name, reversed)
							button.appendInside (QString ("<input type=\"button\" id=\"%1\" value=\"%2\""
									" onclick=\"Action.sendActionOnClick(id)\" />")
											.arg (ActionsNames_.indexOf (name))
											.arg (name));
					}
开发者ID:nobodyzzz,项目名称:leechcraft,代码行数:24,代码来源:kinotifywidget.cpp

示例7:

void
MainWindow::addMessage(PattyIrcMessage *message) {
    QWebElement pageBody = this->ui->baseChatWindow->page()->mainFrame()->documentElement().findFirst("body");
    pageBody.appendInside(message->message);
}
开发者ID:pajlada,项目名称:patty,代码行数:5,代码来源:mainwindow.cpp

示例8: appendFileMessage

// This function is called to display a file request message on chat box
void lmcMessageLog::appendFileMessage(MessageType type, QString* lpszUserName, XmlMessage* pMessage,
									  bool bReload) {
	QString htmlMsg;
	QString caption;
	QString fileId = pMessage->data(XN_FILEID);
	QString tempId;
	QString szStatus;

	htmlMsg = themeData.reqMsg;
	htmlMsg.replace("%iconpath%", "qrc"IDR_FILEMSG);

    FileOp fileOp = (FileOp) Helper::indexOf(FileOpNames, FO_Max, pMessage->data(XN_FILEOP));

	if(type == MT_LocalFile) {
		tempId = "send" + fileId;
		caption = tr("Sending '%1' to %2.");
		htmlMsg.replace("%sender%", caption.arg(pMessage->data(XN_FILENAME), *lpszUserName));
		htmlMsg.replace("%message%", "");
		htmlMsg.replace("%fileid%", tempId);

		switch(fileOp) {
		case FO_Request:
			sendFileMap.insert(fileId, *pMessage);
			pMessage->addData(XN_TEMPID, tempId);

			htmlMsg.replace("%links%", "<a href='lmc://filecancel/" + fileId + "'>" + tr("Cancel") + "</a>");
			break;
		case FO_Cancel:
		case FO_Accept:
		case FO_Decline:
			szStatus = getFileStatusMessage(FM_Send, fileOp);
			htmlMsg.replace("%links%", szStatus);
			break;
		default:
			return;
			break;
		}
	} else if(type == MT_File) {
		tempId = "receive" + fileId;
		if(autoFile) {
			caption = tr("%1 is sending you a file:");
			htmlMsg.replace("%sender%", caption.arg(*lpszUserName));
			htmlMsg.replace("%message%", pMessage->data(XN_FILENAME) + " (" +
				Helper::formatSize(pMessage->data(XN_FILESIZE).toLongLong()) + ")");
			htmlMsg.replace("%fileid%", "");
		} else {
			caption = tr("%1 sends you a file:");
			htmlMsg.replace("%sender%", caption.arg(*lpszUserName));
			htmlMsg.replace("%message%", pMessage->data(XN_FILENAME) + " (" +
				Helper::formatSize(pMessage->data(XN_FILESIZE).toLongLong()) + ")");
			htmlMsg.replace("%fileid%", tempId);
		}

		switch(fileOp) {
		case FO_Request:
			receiveFileMap.insert(fileId, *pMessage);
			pMessage->addData(XN_TEMPID, tempId);

			if(autoFile) {
				htmlMsg.replace("%links%", tr("File has been accepted automatically."));
			} else {
				htmlMsg.replace("%links%", "<a href='lmc://fileaccept/" + fileId + "'>" + tr("Accept") + "</a>&nbsp;&nbsp;" +
					"<a href='lmc://filedecline/" + fileId + "'>" + tr("Decline") + "</a>");
			}

			if(autoFile && !bReload)
				fileOperation(fileId, "fileaccept");
			break;
		case FO_Cancel:
		case FO_Accept:
		case FO_Decline:
			szStatus = getFileStatusMessage(FM_Receive, fileOp);
			htmlMsg.replace("%links%", szStatus);
			break;
		default:
			return;
			break;
		}
	}

	QWebFrame* frame = page()->mainFrame();
	QWebElement document = frame->documentElement();
	QWebElement body = document.findFirst("body");
	body.appendInside(htmlMsg);
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:86,代码来源:messagelog.cpp

示例9: appendMessageLog

void lmcMessageLog::appendMessageLog(QString *lpszHtml) {
	QWebFrame* frame = page()->mainFrame();
	QWebElement document = frame->documentElement();
	QWebElement body = document.findFirst("body");
	body.appendInside(*lpszHtml);
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:6,代码来源:messagelog.cpp

示例10: modifyApplicationTags

// Modify the en-media tag into an attachment
void NoteFormatter::modifyApplicationTags(QWebElement &enmedia, QString &hash, QString appl) {
    if (appl.toLower() == "vnd.evernote.ink") {
            inkNote = true;
            readOnly = true;
            buildInkNote(enmedia, hash);
            return;
    }
    ResourceTable resTable(global.db);
    QString contextFileName;
    qint32 resLid = resTable.getLidByHashHex(note.guid, hash);
    Resource r;
    resTable.get(r, resLid, false);
    if (!r.data.isSet())
        resourceError = true;
    else {

        // If we are running the formatter and we are not generating a thumbnail
        QString mimetype = "";
        if (r.mime.isSet())
            mimetype = r.mime;
        if (mimetype == "application/pdf" && pdfPreview && !thumbnail) {
           modifyPdfTags(resLid, enmedia);
           return;
        }

        // If we are running the formatter so we can generate a thumbnail and it is a PDF
        if (mimetype == "application/pdf" && pdfPreview && thumbnail) {
            QString printImageFile = global.fileManager.getTmpDirPath() + QString::number(resLid) +QString("-print.jpg");
            QString file = global.fileManager.getDbaDirPath() + QString::number(resLid) +".pdf";
            Poppler::Document *doc;
            doc = Poppler::Document::load(file);
            if (doc == NULL)
                return;

            QImage *image = new QImage(doc->page(0)->renderToImage());
            image->save(printImageFile,"jpg");
            delete image;

            enmedia.setAttribute("src", printImageFile);
            enmedia.removeAttribute("hash");
            enmedia.removeAttribute("type");
            enmedia.setOuterXml(enmedia.toOuterXml().replace("<en-media","<img"));
            enmedia.setOuterXml(enmedia.toOuterXml().replace("</en-media>","</img>"));
            return;
        }
        QString fileDetails = "";
        MimeReference ref;
        ResourceAttributes attributes;
        if (r.attributes.isSet())
            attributes = r.attributes;
        if (attributes.fileName.isSet())
            fileDetails = ref.getExtensionFromMime(r.mime, fileDetails);

        enmedia.setAttribute("href", QString("nnres:") +global.fileManager.getDbaDirPath()+QString::number(resLid)
                             +fileDetails);
        contextFileName = global.fileManager.getTmpDirPath("")+QString::number(resLid) +global.attachmentNameDelimeter + fileDetails;

        // Setup the context menu.  This is useful if we want to do a "save as" or such
        contextFileName = contextFileName.replace("\\", "/");
        enmedia.setAttribute("onContextMenu", "window.browserWindow.resourceContextMenu('" +contextFileName +"');");
        enmedia.setAttribute("en-tag", "en-media");
        enmedia.setAttribute("lid", QString::number(resLid));

        enmedia.appendInside("<img/>");
        QWebElement newText = enmedia.lastChild();

        // Build an icon of the image
        QString fileExt;
        if (attributes.fileName.isSet())
            fileExt = attributes.fileName;
        else
            fileExt = appl;
        QString fn;
        QString mime;
        if (attributes.fileName.isSet())
            fn = attributes.fileName;
        if (r.mime.isSet())
            mime = r.mime;
        fileExt = ref.getExtensionFromMime(mime, fn);
        QString icon = findIcon(resLid, r, fileExt);
        newText.setAttribute("src", "file:///"+icon);
        if (attributes.fileName.isSet())
            newText.setAttribute("title",attributes.fileName);
        newText.setAttribute("en-tag", "temporary");
        //Rename the tag to a <a> link
        enmedia.setOuterXml(enmedia.toOuterXml().replace("<en-media","<a"));
        enmedia.setOuterXml(enmedia.toOuterXml().replace("</en-media>","</a>"));
    }
}
开发者ID:Hexcles,项目名称:Nixnote2,代码行数:90,代码来源:noteformatter.cpp

示例11: 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>"));
}
开发者ID:Hexcles,项目名称:Nixnote2,代码行数:63,代码来源:noteformatter.cpp

示例12: appendFileMessage


//.........这里部分代码省略.........
        fileType = "file";
        break;
    case MT_Folder:
        fileType = "folder";
        break;
    default:
        return;
        break;
    }

    htmlMsg = themeData.reqMsg;
    htmlMsg.replace("%iconpath%", "qrc"IDR_FILEMSG);

    FileOp fileOp = (FileOp)wavrHelper::indexOf(FileOpNames, FO_Max, pMessage->data(XML_FILEOP));
    FileMode fileMode = (FileMode)wavrHelper::indexOf(FileModeNames, FM_Max, pMessage->data(XML_MODE));

    if(fileMode == FM_Send) {
        qDebug() << "inside fmsend message";
        tempId = "send" + fileId;
        caption = tr("Sending '%1' to %2.");
        htmlMsg.replace("%sender%", caption.arg(pMessage->data(XML_FILENAME), *lpszUserName));
        htmlMsg.replace("%message%", "");
        htmlMsg.replace("%fileid%", tempId);

        switch(fileOp) {
        case FO_Request:
            sendFileMap.insert(fileId, *pMessage);
            pMessage->addData(XML_TEMPID, tempId);
            htmlMsg.replace("%links%", "<a href='wavr://" + fileType + "/" + cancelOp + "/" + fileId + "'>" + tr("Cancel") + "</a>");
            break;
        case FO_Cancel:
        case FO_Accept:
        case FO_Decline:
        case FO_Error:
        case FO_Abort:
        case FO_Complete:
            szStatus = getFileStatusMessage(FM_Send, fileOp);
            htmlMsg.replace("%links%", szStatus);
            break;
        default:
            return;
            break;
        }
    } else {
        tempId = "receive" + fileId;
        if(autoFile) {
            if(type == MT_File)
                caption = tr("%1 is sending you a file:");
            else
                caption = tr("%1 is sending you a folder:");
            htmlMsg.replace("%sender%", caption.arg(*lpszUserName));
            htmlMsg.replace("%message%", pMessage->data(XML_FILENAME) + " (" +
                wavrHelper::formatSize(pMessage->data(XML_FILESIZE).toLongLong()) + ")");
            htmlMsg.replace("%fileid%", "");
        } else {
            if(type == MT_File)
                caption = tr("%1 sends you a file:");
            else
                caption = tr("%1 sends you a folder:");
            htmlMsg.replace("%sender%", caption.arg(*lpszUserName));
            htmlMsg.replace("%message%", pMessage->data(XML_FILENAME) + " (" +
                wavrHelper::formatSize(pMessage->data(XML_FILESIZE).toLongLong()) + ")");
            htmlMsg.replace("%fileid%", tempId);
        }

        switch(fileOp) {
        case FO_Request:
            receiveFileMap.insert(fileId, *pMessage);
            pMessage->addData(XML_TEMPID, tempId);

            if(autoFile) {
                htmlMsg.replace("%links%", tr("Accepted"));
                if(!bReload)
                    fileOperation(fileId, acceptOp, fileType);
            } else {
                htmlMsg.replace("%links%",
                    "<a href='wavr://" + fileType + "/" + acceptOp + "/" + fileId + "'>" + tr("Accept") + "</a>&nbsp;&nbsp;" +
                    "<a href='wavr://" + fileType + "/" + declineOp + "/" + fileId + "'>" + tr("Decline") + "</a>");
            }
            break;
        case FO_Cancel:
        case FO_Accept:
        case FO_Decline:
        case FO_Error:
        case FO_Abort:
        case FO_Complete:
            szStatus = getFileStatusMessage(FM_Receive, fileOp);
            htmlMsg.replace("%links%", szStatus);
            break;
        default:
            return;
            break;
        }
    }

    QWebFrame* frame = page()->mainFrame();
    QWebElement document = frame->documentElement();
    QWebElement body = document.findFirst("body");
    body.appendInside(htmlMsg);
}
开发者ID:parikshitag,项目名称:wavr,代码行数:101,代码来源:messagelog.cpp


注:本文中的QWebElement::appendInside方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。