From b9dcb3bd9b449da99bb9dfb9aeef4ada353be51b Mon Sep 17 00:00:00 2001 From: krepa098 Date: Fri, 6 Feb 2015 16:12:24 +0100 Subject: [PATCH] cleanup --- src/chatlog/content/text.cpp | 6 +++--- src/chatlog/documentcache.cpp | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index fd7f2f0ef..8d96280e9 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -222,12 +222,13 @@ void Text::regenerate() if(!doc) { doc = DocumentCache::getInstance().pop(); - doc->setDefaultFont(defFont); dirty = true; } if(dirty) { + doc->setDefaultFont(defFont); + if(!elide) doc->setHtml(text); else @@ -238,9 +239,8 @@ void Text::regenerate() opt.setWrapMode(elide ? QTextOption::NoWrap : QTextOption::WrapAtWordBoundaryOrAnywhere); doc->setDefaultTextOption(opt); - // width & layout + // width doc->setTextWidth(width); - doc->documentLayout()->update(); // update ascent if(doc->firstBlock().layout()->lineCount() > 0) diff --git a/src/chatlog/documentcache.cpp b/src/chatlog/documentcache.cpp index d78301fab..093fa7ece 100644 --- a/src/chatlog/documentcache.cpp +++ b/src/chatlog/documentcache.cpp @@ -34,7 +34,10 @@ QTextDocument* DocumentCache::pop() void DocumentCache::push(QTextDocument *doc) { if(doc) + { + doc->clear(); documents.push(doc); + } } DocumentCache &DocumentCache::getInstance()