Results 1 to 3 of 3

Thread: QTextEdit troubles?!

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

    Cool QTextEdit troubles?!

    Hello,

    this is not directly an I-have-a-problem-thread, but instead a thread about two things I noticed about QTextEdit.

    First, it crashes when you try to load a binary file. I open a binary file with QFile and with the Text Attribute enabled, and showing it in QTextEdit makes my application crash. Is this know to Qt 4.1.0?

    Second, the QTextEdit gets very slow when you load more than 100kb. Scrolling and looking at a big file are laggy (I have a 3ghz pc, so on other computers it might be even slower), and doing a simple stringreplacement takes ages (couple of minutes.. dunno, I cancelled after 2 minutes).

    Are these known issues? If so, is there any workaround for those which makes use of Qt functions?

    Thanks for answers

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit troubles?!

    On first question: give your crash-code
    a life without programming is like an empty bottle

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

    Default Re: QTextEdit troubles?!

    Hello,

    the crashcode is really simple, here it is:

    Qt Code:
    1. /////// file.cpp ///////////
    2. QString readFile ()
    3. {
    4. // load file
    5. QFile file(getAbsoluteFilename());
    6. if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    7. throw common::error ("Cannot open file: " + getAbsoluteFilename());
    8.  
    9. // read file and return contents
    10. QTextStream in(&file);
    11.  
    12. return in.readAll();
    13. }
    14.  
    15. //////////
    16. // @param contents is the value returned by readFile()
    17. void setTextToQTextEdit (QString uid, QString label, QString contents)
    18. {
    19. QString log = "fileActionsImpl::createNewDocument: uid = " + uid;
    20. LOG_DEBUG (log.toStdWString());
    21.  
    22.  
    23. QTextEdit* tabpage = new QTextEdit; tabpage->setPlainText(contents);
    24. }
    To copy to clipboard, switch view to plain text mode 

    I suppose this is a Qt bug, can anybody confirm this?

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. QTextEdit, sizeHint, QWidget
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2007, 08:25
  5. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

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.