Important: Please read the Qt Code of Conduct -

Problem about QWebView

  • I use QWebView to show a url page and the Page is loaded successfully. But when i click the link in the page, this is no response. What should I do ?

  • Is it an ordinary link or some javascript? For the latter you need to enable [removed]

    QWebSettings *ws = QWebSettings::globalSettings();
    ws->setAttribute(QWebSettings::JavascriptEnabled, true);
    ws->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);

  • Thanks for your reply. Actually it is a ordinary url.The website url I tested is "", I can not click any link in this page.

  • The site works entirely on javascript - I think you never looked at the source code.

    The javascript methods open separate windows all the time. You will need to look into createWindow methods of [[Doc:QWebView]] and/or [[Doc:QWebPage]]. The default implementations do nothing, this is the reason why you do not see anything. If you load an ordinary page like everything works as expected.

  • Thanks for your answer. You are really a nice man.
    According to your advice, I subclass the QWebPage and override the createWindow() function. Then it works perfectly!

    Thanks again!

Log in to reply