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. QWebkit doesn't handle th as a child?
QtWS25 Last Chance

QWebkit doesn't handle th as a child?

Scheduled Pinned Locked Moved Qt WebKit
3 Posts 1 Posters 981 Views
  • 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.
  • C Offline
    C Offline
    codenode
    wrote on last edited by
    #1

    Hi,

    I don't have yet setup an easy example for this, but the behavoir I'm seeing currently is, when I traverse a Document with QWebkit, I don't get to see any of the th elements in a table, except the first.
    This is my code:

    @void WebAnalyzer::traverse(const QWebElement &element, size_t index)
    {
    tree_stack.push_back(element);
    if(!element_handler(element.tagName().toLower(),tree_stack,index))
    qDebug() << "no handler for " << element.tagName();

    QWebElement child = element.firstChild();
    size_t nthchild =0;
    while(!child.isNull())
    {
        traverse(child,nthchild);
        qDebug() << element.tagName();
        child = element.nextSibling();
        ++nthchild;
    }
    tree_stack.pop_back();
    

    }@

    I do have a breakpoint in the handler for th,tr etc.
    What I see is, that only the first th element gets visited, not the other, so I'm only having the name of the first instead of all columns in the document...

    Is QWebkit usable for such thing as traversing a HTML Document?

    Any hints?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      codenode
      wrote on last edited by
      #2

      Edited the post now. Handler to th only gets called once, not for all elements. seems strange to me...

      1 Reply Last reply
      0
      • C Offline
        C Offline
        codenode
        wrote on last edited by
        #3

        Solved! There is a little hard to spot bug in this code:

        @ child = element.nextSibling();@

        This needs to be child = child.nextSilbling();
        Unfortunately its also the only way to iterate (begin() end() and iterators would be nice).

        But it works now :)

        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