Results 1 to 4 of 4

Thread: Best performance when comparing two QTextEdits

  1. #1
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Best performance when comparing two QTextEdits

    Hello

    I want to compare the contents of two QTextEdits. Basically, this is for a difference view of a text editor. The user can open a second file that syncs with the first (ie. scrolling), what I have done already. Now I want to mark all lines with a yellow background in the second QTextEdit that are different from the according line in the first one. I can think of several ways to do this, but which is the most performant?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Best performance when comparing two QTextEdits

    How big can these textfiles be?
    What is the general size of a textfile?

  3. #3
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    8
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best performance when comparing two QTextEdits

    Well, we're talking of maybe 100k lines max. The general size will be like 10k lines, each line having up to 40-50 characters. Actually a scalable solution would be to only perform on the visible text, so the final size of the QTextEdit would not really matter.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Best performance when comparing two QTextEdits

    I would use QtConcurrent to run the processing outside the main event loop.

    Have a look at the longest common subsequence algorithm.

  5. The following user says thank you to tbscope for this useful post:

    leenxkewl (16th October 2010)

Similar Threads

  1. Printing JPEG images from QTextEdits
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2010, 19:23
  2. Performance
    By manojmka in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 8th March 2010, 20:00
  3. Comparing the |(shift+\) char
    By warry in forum Newbie
    Replies: 1
    Last Post: 8th September 2008, 07:05
  4. Problem with comparing two QDateTime objects
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2008, 11:27
  5. Comparing Items In List Box
    By kenny_isles in forum Qt Programming
    Replies: 9
    Last Post: 21st February 2007, 13:06

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.