mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
cleanup
This commit is contained in:
parent
f525fa83f3
commit
b9dcb3bd9b
|
@ -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)
|
||||
|
|
|
@ -34,7 +34,10 @@ QTextDocument* DocumentCache::pop()
|
|||
void DocumentCache::push(QTextDocument *doc)
|
||||
{
|
||||
if(doc)
|
||||
{
|
||||
doc->clear();
|
||||
documents.push(doc);
|
||||
}
|
||||
}
|
||||
|
||||
DocumentCache &DocumentCache::getInstance()
|
||||
|
|
Loading…
Reference in New Issue
Block a user