How to mimic in QWebKit something like "Inspect" in firebug?
-
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()));
@ -
Oh OK. I think it is possible....
First, reimplement:
@void QWebView::mousePressEvent(QMouseEvent * ev)@
you then can get position of click from QMouseEventusing 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...