Results 1 to 3 of 3

Thread: How does QTextEdit store the text?

  1. #1
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How does QTextEdit store the text?

    Hi,

    I want to implement a fuzzy search in a QTextEdit, so I want to know how does it store the text, basically what I need is the list of words and the position of each word (to move the cursor there), is there a way to get that, or should I just get the plain text and do it myself?

    Thanks

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How does QTextEdit store the text?

    You could use QTextCursor to go over the entire document word by word, keep a list of the words, and use position() to remember its position. Depends on what you want exactly. QTextEdit has a find() function too.

    Regards,
    Marc

  3. #3
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How does QTextEdit store the text?

    Thanks for answering,

    I did what you say, and it worked just as I wanted.

    I've seen in the source code that the text is separated in blocks, I'll take a look later.

    Cheers.

Similar Threads

  1. how to get the text from QTextEdit
    By qt_user in forum Qt Programming
    Replies: 5
    Last Post: 22nd August 2011, 00:22
  2. QTextEdit::text()
    By hazardpeter in forum Newbie
    Replies: 2
    Last Post: 5th August 2009, 21:13
  3. Replies: 5
    Last Post: 8th April 2008, 23:10
  4. QTextEdit + paste rich text as plain text only
    By Yong in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2008, 16:45
  5. QTextEdit -> add Text
    By ape in forum Newbie
    Replies: 16
    Last Post: 19th December 2007, 14:59

Tags for this Thread

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.