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

Highlight a selected text



  • Hi all,

    I need to highlight a selected text.

    I tried using the below code.
    @
    findText(page()->selectedText(), QWebPage::HighlightAllOccurrences);
    @
    but it highlight's all the occurrences. But i want highlight only the selected text. How do i go above it.

    Thanks
    DavidBoon



  • I wonder why you use the HighlightAllOccurrences flag if all you want is to highlight the current occurrence?



  • Thanks for your reply. I am new to Qt. I search all documents in Qt. I found only the QWebPage::HighlightAllOccurrences flag . But not able to find a flag which highlights the current occurrence. I would like to know how to highlight the current occurrence?



  • Did you try the same method without that flag?



  • yes, we tried and it's not getting highlighted.


Log in to reply