Hello All,

I'm trying to make a custom TextEditor with some cool features, but I have a show stopper here its the perf of this widget...
I'm drag and dropping a 200Kb text file, and it takes approx 5s to load, where it's near to instantly on most of other standard text editor...

I'm filling the widget like this:
Qt Code:
  1. void logEditor::dropEvent(QDropEvent *de)
  2. {
  3. // Unpack dropped data and handle it the way you want
  4. const QMimeData* mimeData = de->mimeData();
  5.  
  6. // check for our needed mime type, here a file or a list of files
  7. if (mimeData->hasUrls())
  8. {
  9. QList<QUrl> urlList = mimeData->urls();
  10. // extract the local paths of the files
  11. for (int i = 0; i < urlList.size(); ++i)
  12. {
  13. QFile file(urlList.at(i).toLocalFile());
  14. if (!file.open (QIODevice::ReadOnly))
  15. return;
  16.  
  17. QTextStream stream ( &file );
  18. //QString line;
  19. setIsUpdating();
  20. while( !stream.atEnd() ) {
  21. //line = stream.readLine();
  22. this->appendPlainText(stream.readLine());
  23. }
  24. file.close(); // when your done.
  25. setIsUpdating(false);
  26. }
  27.  
  28. }
  29. }
To copy to clipboard, switch view to plain text mode 

I have also customized a few things, but I therefore disabling all painting events while i'm filling the text, with the setIsUpdating function.
I also even disabled all the fancy stuff to only have a QPlainTextEdit sublass with the drag and drop event and I still have this slowness.

Full code of the editor can be seen here: http://pastebin.com/1jGtFTX8

I don't really know why is it so slow :/

Any ideas ?