Results 1 to 13 of 13

Thread: QTextEdit loading takes long time

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextEdit loading takes long time

    I'd say that loading 500k lines of text into a simple text editor like QTextEdit is nothing but a suicide
    How exactly do you load it? Using QTextDocument or QTextEdit::setPlainText() or simmilar?

  2. #2
    Join Date
    Feb 2006
    Posts
    60
    Thanks
    21
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTextEdit loading takes long time

    I load the text using setPlainText(text)

    regards

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextEdit loading takes long time

    Quote Originally Posted by sreedhar
    I load the text using setPlainText(text)
    That's why it takes so much time. You should create a QTextDocument first and then use QTextEdit::setDocument() to make QTextEdit display it. It should operate much faster on the text then.

  4. The following user says thank you to wysota for this useful post:

    sunil.thaha (16th June 2006)

  5. #4
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit loading takes long time

    I have tried loading the text on a separate timer, as described here on this thread. This leads to a fist and fast disaplay, and then the UI gets freezed for several seconds. I also tried some sort of thread test, and still got the same effect with much uglier code.

    I will try the example described here with the separate QTextDocument. This might solve some issues.

    But still, the problem may be the slow paiting in the syntax highlighter, can you show some code?

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.