Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem about QWebView
Qt 6.11 is out! See what's new in the release blog

Problem about QWebView

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    isml
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      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);
      @

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • I Offline
        I Offline
        isml
        wrote on last edited by
        #3

        Thanks for your reply. Actually it is a ordinary url.The website url I tested is "http://www.csdn.net", I can not click any link in this page.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          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 http://google.com/ everything works as expected.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • I Offline
            I Offline
            isml
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved