Hi guys! 
I want to implementation VIPS algorithm.So, I need to get the coordinates and 
size of the page elements.For example,in this page:www.google.com, there is one 
picture(logo),i want to know the location and size in the window after page 
rendering.And i want to get the coordinates of the text.
Here is my code,but it's doesn't work correctly:

void traversal(QWebElement node)
{ 
     QRect ss = node.geometry();
     printf("Tag Name:%s Start: X-%d,Y-%d  Size:%d\n", 
qPrintable(node.tagName()), ss.topLeft().x(), 
ss.size().width()*ss.size().height());
     ...//traversal the child node
     return ;
}

int main(int argc, char *argv[])
{
    QString content(source);
    QUrl url("file:///home/rmss/zp/1_files");
    QApplication a(argc, argv);
    QWebView *view = new QWebView;
    view->setHtml(content, url);
    view->show();
 
    QWebPage* page = view->page();
    QWebFrame* frame = page->mainFrame();
    QWebElement document = frame->documentElement();
    QWebElement body = document.findFirst("body");
    traversal(body);
    return 0;
}
Please tell me what's wrong of my program? Does geometry function satisfy my 
requirement?

        Zhou Peng
        [email protected] 
          2011-02-28 
_______________________________________________
webkit-qt mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt

Reply via email to