Hey there,

I'm using a QTextDocument and QTextCursor::insertImage.
The goal is to remplace : - ) keywords by a in the text document.

Qt Code:
  1. ZePictureWidget * test = new ZePictureWidget("zeData/zeSmileys/Crying.png");
  2. document()->addResource(QTextDocument::ImageResource, QUrl("test"), test->getPixmap());
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //=============================================================================
  2. //=============================================================================
  3.  
  4. void ZeSmileyController::scanSmiley(QTextDocument & textDocument,
  5. const QString & smiley,
  6. const QString & path)
  7. {
  8. QTextCursor textCursor;
  9. textCursor = textDocument.find(smiley);
  10. while (textCursor.isNull() == false)
  11. {
  12. textCursor.deleteChar();
  13. textCursor.insertImage("test");
  14.  
  15. textCursor = textDocument.find(smiley);
  16. }
  17. }
To copy to clipboard, switch view to plain text mode 

Unfortunately when replacing 100 smileys it's very slow, it's like the Cursor is reloading the smileys over and over again.

Any idea?