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. [Solved] General questions about QWebView and QWebElement
Forum Update on Monday, May 27th 2025

[Solved] General questions about QWebView and QWebElement

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 1 Posters 2.5k 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.
  • A Offline
    A Offline
    alexandros
    wrote on last edited by
    #1

    So, I have a QWebView and I load a web page inside it.

    Then, I get the document:

    @QWebElement document = webView->page()->mainFrame()->documentElement();@

    Question 1: When I edit the 'document' does it update automatically inside my QWebView ?

    This is how I edit my document (simplified code, it misses crash checks etc):

    @QWebElementCollection collection = document.findAll(search_for);
    QWebElement cur_element=collection.at(0);
    cur_element.setAttribute(attribute, value);
    cur_element.setFocus();@

    Question 2: When an element has focus (which in my case, it will be an element tagged "input"), how can I simulate an Return (Enter) key event into my QWebView so as not to search for the submit button and generalize more the submit process? (e.g. I don't want to do this: http://paste.ubuntu.com/6258346/)

    Question 3: When a form is submitted (hopefully by simulating a key enter press event (or if a QWebElement tagged "button" is clicked) does my QWebView loads again? Because I want to know whether the loadFinished() signal is emitted again.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      alexandros
      wrote on last edited by
      #2

      I solved all of my issues, here are the answers:

      Question 1:

      YES!

      Question 2:

      webView->event(new QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier));

      Question 3:

      Yep!

      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