Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to get everything before and after selectedText() or selectedHTML() (or the start and end position of a selection)



  • Hi!

    I was wondering if anyone could suggest how to do the following:

    • when a user selects some text on a page in QWebView with their mouse
    • I want to get all the text preceding the selected fragment
    • and I want to get all the text succeeding it

    Or, alternatively, I would like to be able to get the start and end position of a selection so that I can get everything before and after the selected fragment from the page object directly.

    Cheers,
    Erica


Log in to reply