hello guys,

i'm trying to implement a feature with the Qt webkit such that when
the user clicks on a web page, i can know the corresponding html tag
that he/she is clicking. for example, if the user clicks an image, i
should be able to get <img> tag and also the src attribute.

i modified the hitTestContent function in this way:

QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const
{
    if (!d->frame->view() || !d->frame->contentRenderer())
        return QWebHitTestResult();

    HitTestResult result =
d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos),
/*allowShadowContent*/ false);

        printf("Inner Node Type:%d;\n",result.innerNode()->nodeType());

        std::cout<<"node value:"<<(result.innerNode()->nodeValue().operator
QString()).toStdString()<<std::endl;

        if(result.innerNode()->nodeType()==Node::ELEMENT_NODE)
        {
                Element* oldElement = static_cast<Element*>(result.innerNode());
                std::cout<<(oldElement->tagName().operator
QString()).toStdString()<<std::endl;
        }
        else if(result.innerNode()->nodeType()==Node::TEXT_NODE)
        {
                printf("text node!\n");
        }
    return QWebHitTestResult(new QWebHitTestResultPrivate(result));
}


this code works for text nodes and element nodes. but when i click on
a piece of flash movie, such as a youtube movie, the hitTestContent
isn't called. i don't know can i get the flash information by
clicking. thanks.
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to