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?
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::page() to get the page.
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?
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?
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?
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...
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?
Re: Get data in the QT web browser and show message in text box
No, there is no such signal.