Search code examples
c++qtqtwebkit

QWebkit display local webpage


I'm working at a browser-like project based on QtWebKit.
It can display any webpage as good as any other browser can, but I can't make display local html documents!

I am using a QtWebView in a QMainWindow and I'm loading pages with

view->show();

Can anyone tell me what is wrong?

Thank you wery much!!!


Solution

  • I don't see anything different than loading a normal web page, but anyway this is taken from my answer here:

    #include <QtGui/QApplication>
    #include <QWebView>
    
    int main(int argc, char* argv[])
    {
        QApplication a(argc, argv);
        QWebView view;
        view.setUrl(QUrl("file:///home/luca/mypage.html"));
        view.show();
        return a.exec();
    }