How to load html source from string code to QWebView[SOLVED]
-
Does it compile ?
If your htmlText does not contain any external data then you don't need to provide QUrl. See "here":https://qt-project.org/doc/qt-5/qwebview.html#setHtml for more details.
Provide only htmlText
@
ui->webView->setHtml(htmlText);
@ -
The "doc for Qt 5.3":https://qt-project.org/doc/qt-5/qwebview.html#setHtml says that it has two parameters with default second parameter.
@
void QWebView::setHtml(const QString & html, const QUrl & baseUrl = QUrl())
@
It means that you don't have to provide the second parameter if the default one is good enough for your needs.BTW, what version of Qt do you use?
Do you have compile error or run-time error when you try to use one parameter?
-
Qt version 5.2.1. Second parameter is not default, because i get error
"Error...":http://yadi.sk/d/gHOnhJLXRjywE
-
This is different class.
We were talking about "QWebView":https://qt-project.org/doc/qt-5/qwebview.html ::setHtml() and you have error in "QWebPage":http://qt-project.org/doc/qt-5/qwebpage.html
QWebPage does not have such function. -
Do you have QT += webkitwidgets in the Formula.pro file?