本文整理汇总了C++中QWebEngineView::setHtml方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebEngineView::setHtml方法的具体用法?C++ QWebEngineView::setHtml怎么用?C++ QWebEngineView::setHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView::setHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayHtml
void QRestClient::displayHtml(QByteArray html)
{
QWebEngineView *view = new QWebEngineView();
view->setAttribute(Qt::WA_DeleteOnClose);
view->setHtml(html);
view->show();
}
示例2: loadErrorPage
void TitleBar::loadErrorPage()
{
#ifdef USEWEBENGINE
QWebEngineView* comments = noteView()->commentView();
#else
noteView()->commentWidget()->hideLocalProgress();
QWebView* comments = noteView()->commentView();
comments->setVisible(true);
#endif
QString strFileName = Utils::PathResolve::resourcesPath() + "files/errorpage/load_fail_comments.html";
QString strHtml;
::WizLoadUnicodeTextFromFile(strFileName, strHtml);
QUrl url = QUrl::fromLocalFile(strFileName);
comments->setHtml(strHtml, url);
}
示例3: loadErrorPage
void TitleBar::loadErrorPage()
{
#ifdef USEWEBENGINE
QWebEngineView* comments = noteView()->commentView();
#else
QWebView* comments = noteView()->commentView();
#endif
QString strFileName = Utils::PathResolve::resourcesPath() + "files/errorpage/load_fail_comments.html";
QString strHtml;
::WizLoadUnicodeTextFromFile(strFileName, strHtml);
strHtml.replace("{error_text1}", tr("Load Error"));
strHtml.replace("{error_text2}", tr("Network anomalies, check the network, then retry!"));
strHtml.replace("{error_text3}", tr("Load Error"));
QUrl url = QUrl::fromLocalFile(strFileName);
comments->setHtml(strHtml, url);
}
示例4: show
void PublisherPage::show()
{
QWebEngineView *view = new QWebEngineView;
QDir dir;
QString cwd = dir.currentPath();
QString html = "qrc:///vpub/index.html";
QString fpath = "/src/qt/res/vpub/index.html";
QString res = cwd + fpath;
QFile file(res);
// QFile file("file:////res/pbt/index.html");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
html = QString("<html><body><p>Cannot read file in ") + res + QString("</p></body></html>");
} else {
html = QTextStream(&file).readAll();
};
view->setHtml(html, QUrl());
view->show();
}