I have implemented a code to get a name of html tag from webpage where user clicked. To get tag name, I have used “hitTestContent” function. Below is the code which I used in Qt 4.8 demo browser:- void WebView::mousePressEvent(QMouseEvent *event) { m_page->m_pressedButtons = event->buttons(); m_page->m_keyboardModifiers = event->modifiers(); QWebView::mousePressEvent(event); QWebFrame *pFrame = m_page->frameAt(event->pos()); QWebHitTestResult HitResult = pFrame->hitTestContent(event->pos()); QWebElement WebElement = HitResult.element(); if (!WebElement.isNull()) //Control does not enter in this loop for <span> tag { qDebug() << "Mouse Pressed:" << WebElement.localName() << WebElement.parent().localName(); } } I am able to get almost all tag name when I clicked on webpage. But this code fails for <span> tag. I have checked this in Qt 4.7, but the result is same.
Do you have a test case?
I suspect this is a duplicate of bug #87341, which I hope will be fixed. I am experiencing a problem (Qt 4.7.1) with QWebHitTestResult::element(). Whenever any TEXT is hit by the point passed to hitTestContent(), the element returned is null, even though the QWebHitTestResult::boundingRect() is correct and valid. Regards Ryan Cuthbertson
=== Bulk closing of Qt bugs === If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary. If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.
Mass move bugs into the DOM component.