Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Finding html elements from qtbrowser
QtWS25 Last Chance

Finding html elements from qtbrowser

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 633 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.
  • S Offline
    S Offline
    sarahjohn
    wrote on last edited by
    #1

    Hi,
    I am trying to find html elements in a webpage from qtbrowser.I tried using
    @QWebElement el = view->page()->mainFrame()->findFirstElement("#mainDiv");
    QRect rectimage = el.geometry();
    qWarning()<<"Maindiv Coordinate"<<rectimage.x()<<rectimage.y();@
    But I have a "subDiv" inside the "mainDiv".When I tried simply giving the name of the div as above I am getting (0,0).
    How can I find the subDiv 's coordinates.

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on last edited by
      #2

      I haven't worked with the qtbrowser yet but you probably have to access it's child. Maybe you can use .firstChild() for that so it will look somehow like that:

      @QWebElement el = view->page()->mainFrame()->findFirstElement("#mainDiv");
      QRect rectimage = el.firstChild().geometry();
      qWarning()<<"Maindiv Coordinate"<<rectimage.x()<<rectimage.y();@

      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