Results 1 to 6 of 6

Thread: QTextEdit super slow resize

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default QTextEdit super slow resize

    Qt Code:
    1. QTextEdit * test = new QTextEdit;
    2. QString string;
    3. for (int i = 0; i < 50000; i++)
    4. {
    5. string += 'o';
    6. }
    7. test->setText(string);
    8. test->show();
    To copy to clipboard, switch view to plain text mode 

    == Super slow window resize.

    How can I optimize this ?

  2. #2
    Join Date
    Aug 2006
    Posts
    250
    Thanks
    19
    Thanked 49 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTextEdit super slow resize

    I assume its the word wrap that's killing your performance here. If you really need fast resizes, I would suggest manual word wrap + scroll bars.

  3. The following user says thank you to pherthyl for this useful post:

    bunjee (12th May 2008)

  4. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QTextEdit super slow resize

    You're right, the word wrap seems to be the reason.

    Did you implement your own wordwrap algorithm ? Why is qt's default one so slow ?

  5. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit super slow resize

    Quote Originally Posted by bunjee View Post
    Why is qt's default one so slow ?
    Because it requires the layout of the whole document to be re-computed, which can be a quite time-consuming operation.
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTextEdit super slow resize

    How about QPlainTextEdit...
    J-P Nurmi

  7. #6
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QTextEdit super slow resize

    I'll take a look.

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 auto resize
    By bunjee in forum Qt Programming
    Replies: 4
    Last Post: 26th October 2007, 19:59
  3. QTextEdit extremely slow with links
    By elahav in forum Qt Programming
    Replies: 2
    Last Post: 25th May 2006, 18:00

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.