Results 1 to 4 of 4

Thread: Need help in Qwebview, find test in HTML page

  1. #1
    Join Date
    Feb 2011
    Posts
    29
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Need help in Qwebview, find test in HTML page

    Hi all,

    I am currently stuck in one problem. I am opening one HTML page using webkit module of QT. The is opening perfectly. But now i want to find text in that page.

    How can i do that? Please give me some code example so that i can implement it. Below is my code to open HTML page.

    .H file

    Qt Code:
    1. class my2 : public QWidget , private Ui_Form
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. explicit my2(QWidget *parent = 0, Qt::WindowFlags f = 0 );
    7. ~my2();
    8.  
    9. public:
    10. void setBaseUrl(const QUrl &url);
    11.  
    12. private:
    13. QUrl baseUrl;
    14. };
    To copy to clipboard, switch view to plain text mode 

    In C file

    Qt Code:
    1. my2::my2(QWidget *parent, Qt::WindowFlags f ) :
    2. QWidget(parent,f)
    3. {
    4. setupUi(this);
    5. baseUrl = "http://www.itisl.com/Luminum/E-Book/Infotek/Physics/ch8/index.html";
    6. setBaseUrl(baseUrl);
    7. }
    8.  
    9. void my2::setBaseUrl(const QUrl &url)
    10. {
    11. webView->setUrl(url);
    12. }
    To copy to clipboard, switch view to plain text mode 

    I have use Qwebview widget.
    By this i m able to open HTML page perfectly. Now how can i find any word in this HTML page. Please tell me some solution so that i can solve this problem.

    Thanks in Advance.

    Regards,
    Keyur Parekh
    Last edited by wysota; 18th May 2011 at 14:27.

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Need help in Qwebview, find test in HTML page

    You want to find a webelement in html page? Or just a word in it.
    Refer QRegExp class. You can pretty much do anything if you know this class well enough.

  3. #3
    Join Date
    Feb 2011
    Posts
    29
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: Need help in Qwebview, find test in HTML page

    I need to find word from HTML page. If i type any word it should highlight that word in page.

  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: Need help in Qwebview, find test in HTML page

    To do it properly you need to traverse all elements of the DOM using QWebElement API, look for your text and act accordingly.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Hot do I get HTML source from a web page?
    By earendil in forum Newbie
    Replies: 9
    Last Post: 16th March 2012, 15:15
  2. Snapshot of HTML page with flash contents
    By GoGetIt in forum Qt Programming
    Replies: 0
    Last Post: 23rd August 2010, 13:29
  3. Editing in text box of web page : QWebView
    By girishgowda in forum Qt Programming
    Replies: 0
    Last Post: 13th July 2010, 11:42
  4. Html page Display in QWebView
    By Tavit in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2010, 15:39
  5. Widget to display an HTML page ?
    By probine in forum Qt Tools
    Replies: 3
    Last Post: 11th October 2006, 18:55

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.