Results 1 to 4 of 4

Thread: WebEngineView->findText()

  1. #1
    Join Date
    Feb 2015
    Posts
    185
    Thanks
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default WebEngineView->findText()

    I am using QWebEngineView to display the .html page.

    I try to use findText to find where the search text is found on the loaded page.

    Qt Code:
    1. bool textFound;
    2. findText(QStringLiteral("Experience"), QWebEnginePage::FindFlags(), [this](bool found) { textFound = found;});
    3. if(textFound)
    4. {
    5. // do my processing
    6. }
    To copy to clipboard, switch view to plain text mode 

    When I execute this code, getting error as below
    error: expected expression
    findText(QStringLiteral("Experience"), QWebEnginePage::FindFlags(), [this](bool found) { qDebug()<<"inside";});
    ^

    Kindly help me resolve this issue.
    Last edited by ejoshva; 17th June 2015 at 11:06.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: WebEngineView->findText()

    Dont you need to call the findText function via an object ??

  3. #3
    Join Date
    Feb 2015
    Posts
    185
    Thanks
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: WebEngineView->findText()

    I am calling this from inside the webengineview class

  4. #4
    Join Date
    Feb 2015
    Posts
    185
    Thanks
    5
    Qt products
    Qt5
    Platforms
    MacOS X Windows

    Default Re: WebEngineView->findText()

    Qt Code:
    1. void WebEngineView::foundText(bool value)
    2. {
    3. textFound = value;
    4. }
    5.  
    6. void searchText()
    7. {
    8. findText(QStringLiteral("exception"), QWebEnginePage::FindFlags(),
    9. [=](bool found) { foundText(found); }
    10. );
    11. }
    To copy to clipboard, switch view to plain text mode 

    This is the code which works

Similar Threads

  1. Mouseevents on a QwebView or WebEngineView
    By Tinu in forum Qt Programming
    Replies: 5
    Last Post: 8th April 2015, 09:51

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.