Results 1 to 2 of 2

Thread: QTextEdit->find()

  1. #1
    Join Date
    Sep 2006
    Posts
    38
    Thanks
    5
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default QTextEdit->find()

    I'm having a bit of a mind block for something that could be so obvious. I have a TextBrowser that's read only and I want to find specific text in a line, but the text may not be in consecutive words. For instance, I want the TextBrowser to scroll to the line saying "The quick brown fox jumped over the lazy dog" when somebody searches for "the quick brown over dog." I can't exactly feed the criteria to QTextEdit::Find() since it does an exact string match.

    Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit->find()

    You could try to use QTextDocument::find() (the one with QRegExp parameter), but first you have to exactly define the search criteria.

    What exactly "may not be in consecutive words" means? Is there a maximum number of non-matching words you can skip? Or maybe you want to look for "the quick brown over" if there are no matches for "the quick brown over dog"?

Similar Threads

  1. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  2. QTextEdit, sizeHint, QWidget
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 08:25
  3. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  4. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 19:27
  5. Obtaining clean (x)html from QTextEdit
    By ccf_h in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2006, 14:47

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.