Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [Solved] Debugging scripts that run in a QWebView widget
Forum Updated to NodeBB v4.3 + New Features

[Solved] Debugging scripts that run in a QWebView widget

Scheduled Pinned Locked Moved Qt WebKit
12 Posts 6 Posters 18.5k 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.
  • E Offline
    E Offline
    entuland
    wrote on last edited by
    #1

    Hi there,
    anybody knows how to debug scripts that run into a QWebView widget?

    I've thought about attaching a QScriptEngineDebugger to the QScriptEngine of the main QWebFrame of that widget, but to the best of my searches on the web and in the documentation, there is no QScriptEngine accessible from the QWebFrame interface - I wonder what engine gets used by the evaluateJavaScript() slot.

    Any hint or suggestion?

    Thanks a lot for your attention!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      entuland
      wrote on last edited by
      #2

      Silly me, I can use the QWebInspector... sorry for the noise!

      1 Reply Last reply
      0
      • F Offline
        F Offline
        florent.revelut
        wrote on last edited by
        #3

        Another solution, less intrusive is to subclass webpage and reimplement:
        @
        virtual void javaScriptAlert ( QWebFrame * frame, const QString & msg )
        virtual bool javaScriptConfirm ( QWebFrame * frame, const QString & msg )
        virtual void javaScriptConsoleMessage ( const QString & message, int lineNumber, const QString & sourceID )
        virtual bool javaScriptPrompt ( QWebFrame * frame, const QString & msg, const QString & defaultValue, QString * result )
        @

        [EDIT: added code formatting tags, Volker]

        1 Reply Last reply
        0
        • E Offline
          E Offline
          entuland
          wrote on last edited by
          #4

          Thanks a lot for your follow-up Florent, that technique will indeed come useful.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JoyceBabu
            wrote on last edited by
            #5

            How can I add QWebInspector to QWebView? I couldn't find any sample code.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              entuland
              wrote on last edited by
              #6

              I just enabled it by adding this line in the constructor of my main window:

              @
              QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
              @

              Then I right-click on any QWebView at runtime and I select "Inspect" - more knowledgeable people around will give deeper insight, eventually.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                JoyceBabu
                wrote on last edited by
                #7

                Thanks a lot, entuland. It was really helpful.

                [quote author="entuland" date="1294223335"]I just enabled it by adding this line in the constructor of my main window:

                @
                QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
                @

                Then I right-click on any QWebView at runtime and I select "Inspect" - more knowledgeable people around will give deeper insight, eventually.[/quote]

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  DavidGOrtega
                  wrote on last edited by
                  #8

                  Another interesting idea that I worked with is use JsLint inside the frame.

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    JoyceBabu
                    wrote on last edited by
                    #9

                    Do you have sample code? Thanks.

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      entuland
                      wrote on last edited by
                      #10

                      Some example about using JsLint in the Qt context would interest me too!

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        RocketSauce
                        wrote on last edited by
                        #11

                        Thank you! This saved me a patch of hair or two.

                        1 Reply Last reply
                        0
                        • V Offline
                          V Offline
                          vadim.kisly
                          wrote on last edited by
                          #12

                          Hello entuland,

                          Could you please advise what solution was selected. I have the same question and still have no solution.

                          Thank you in advance,
                          Vadim

                          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