1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
This commit is contained in:
krepa098 2015-02-06 16:12:24 +01:00
parent f525fa83f3
commit b9dcb3bd9b
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -34,7 +34,10 @@ QTextDocument* DocumentCache::pop()
void DocumentCache::push(QTextDocument *doc)
{
if(doc)
{
doc->clear();
documents.push(doc);
}
}
DocumentCache &DocumentCache::getInstance()