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. How to mimic in QWebKit something like "Inspect" in firebug?
Forum Updated to NodeBB v4.3 + New Features

How to mimic in QWebKit something like "Inspect" in firebug?

Scheduled Pinned Locked Moved Qt WebKit
4 Posts 2 Posters 2.0k 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.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    Hello all
    i like to be able to mimic the function of firebug ( browser plugin ) inspect functionality .
    i found something that called inspector in webkit , but i have no idea how to implement it
    or if its even related to this .
    thanks

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      You do not need to implement inspector, it is already in webkit.
      simply enable developer extras:
      @
      QWebView::settings()->globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
      @
      and call inspector when you need it:
      @
      QWebInspector * m_inspector = new QWebInspector(0);
      m_inspector->setPage(this->page());//set pointer to QWebPage which you want to inspect...
      QTimer::singleShot(0, m_inspector,SLOT(show()));
      @

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        Thanks for the replay , what i want is to be able to right click with the mouse and then the selected html element will be highlighted and the element innerHTML will content will be available to me , i need the general idea on how to do this

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          Oh OK. I think it is possible....

          First, reimplement:
          @void QWebView::mousePressEvent(QMouseEvent * ev)@
          you then can get position of click from QMouseEvent

          using this position get QWebFrame from QWebPage of your QWebView:
          @
          QWebFrame * frameAt(const QPoint & pos) const
          @

          Do an hint test on this QWebFrame:
          @
          QWebHitTestResult QWebFrame::hitTestContent(const QPoint & pos) const
          @

          in returned QWebHitTestResult you will get your hint test result and QWebElement under this position:
          @
          QWebElement element() const
          @

          after that examine QWebElement for any kind of information in this DOM element.

          Should work, but i didn't tested it... but I think the standard WebKit inspector is doing it exactly this way...

          God is Real unless explicitly declared as Integer.

          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