Results 1 to 8 of 8

Thread: Get data in the QT web browser and show message in text box

  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Get data in the QT web browser and show message in text box

    The new QT (4.4) has a widget or feature that allows to have a web browser as part of a widget or window.

    This Web browser can show different pages, as a regular browser.

    I want to do something simple:

    I have this browser and I request a page. I also have a text box (not as part of the browser, but as part of my QT widget - A QT Text box). When I get the website in the QT browser, then I want to show the title of the website in my QT Text Box.

    Is it possible?
    How?
    What are the signals or slots I will have to use?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get data in the QT web browser and show message in text box

    Signals and slots are not enough here. Use QWebFrame::title() to get the title, QWebPage::mainFrame() to fetch the frame and QWebView:age() to get the page.

  3. #3
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get data in the QT web browser and show message in text box

    Ok, this is exactly what I need:

    1. I get a website in the QT Web Browser. That website contains a text box with a value. Lets say that that value is "Hello"

    2. QT Web Browser should "see" that the website, in a text box, contains the word "Hello" and therefore my program should copy the "Hello" word from the website to the QT Text box.

    Is this possible?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get data in the QT web browser and show message in text box

    So you want to display the title of the webpage or contents of some text box?

  5. #5
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get data in the QT web browser and show message in text box

    Example:

    A website has a text box:

    <div><input type="text" value"Hello"/></div>

    When I get this website in the QT Web Browser I want to get the content of the wbsite text box and put this content (Hello) in a QT Text box.

    Is it possible, how?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get data in the QT web browser and show message in text box

    It should be possible, but it requires much work. You'd have to parse the page looking for the box and ripping its contents from html. As for doing it live... it should be possible by looking through the widget children of QWebView, but it's much work as well...

  7. #7
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Get data in the QT web browser and show message in text box

    ok, then it is easy to get the title of the page.

    Is there any kind of signal slot that could tell me when the title has changed?

    The idea is that I don't want to be parsing the page constantly, so I will parse it only when the title of the page has changed, but I don't want to be checking for this change every second, so I will rather like to have a signal that will trigger something on the code.

    Is it possible?
    How?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Get data in the QT web browser and show message in text box

    No, there is no such signal.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.