I try show a html file in webview, but I surprised because me always get a blank page.
I generate a html file with my function call htmlgenerate(). The file is created with successful, but I don't know why webview just give me a blank page. If I use firefox for display my html file, everything is fine.

This is my code for display

Qt Code:
  1. void Dialog::showHtml()
  2. {
  3. htmlgenerate(); // save to QDir::tempPath ()+"/tahede.html"
  4.  
  5. Viewer *lap0=new Viewer(this);
  6. lap0->setPage(QUrl(QDir::tempPath()+"/tahede.html"));
  7. lap0->reload();
  8. lap0->exec();
  9. }
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. void Viewer::setPage(QUrl url)
  2. {
  3. //web is QWebView
  4. m_ui->web->setUrl(url);
  5. }
  6.  
  7.  
  8. void Viewer::reload()
  9. {
  10. m_ui->web->reload();
  11. qDebug() << m_ui->web->url(); // result always QUrl( "about:blank" )
  12. }
To copy to clipboard, switch view to plain text mode 


Btw, I always remove my html every close my application
Qt Code:
  1. void MainWindow::closeEvent(QCloseEvent *event)
  2. {
  3. QFile::remove(QDir::tempPath()+"/tahede.html");
  4. }
To copy to clipboard, switch view to plain text mode