Results 1 to 2 of 2

Thread: QTextEdit - Finding text within selection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTextEdit - Finding text within selection

    <warning type="top of head" />

    How about something like this:
    • Grab the QTextEdit::textCursor()
    • If no selection then return?
    • Position newcursor at start of selection
    • Execute newcursor = find(str, newcursor, opts)
    • If newcursor still inside selection then report match and repeat find(). You have operator<() to compare cursors, or you can use the start or end positions manually.

  2. The following user says thank you to ChrisW67 for this useful post:

    kringen (10th June 2012)

Similar Threads

  1. Replies: 4
    Last Post: 11th September 2011, 01:39
  2. Problem with Finding the Text
    By charlesprime in forum Qt Programming
    Replies: 4
    Last Post: 24th March 2011, 10:10
  3. Problem finding text in a QTextEdit
    By Vash5556 in forum Qt Programming
    Replies: 8
    Last Post: 18th May 2009, 14:19
  4. Multiple selection in QTextEdit
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 1st July 2006, 07:58
  5. Finding text on Text edit
    By jyoti kumar in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2006, 13:20

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
  •  
Qt is a trademark of The Qt Company.