1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

2x faster Text::regenerate

Hopefully without breaking anything substantial
This commit is contained in:
tux3 2016-01-21 07:13:10 +01:00
parent 217716184b
commit 24bccb7bdd
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -246,18 +246,23 @@ void Text::regenerate()
{
doc->setDefaultFont(defFont);
// wrap mode
if (elide)
{
QTextOption opt;
opt.setWrapMode(QTextOption::NoWrap);
doc->setDefaultTextOption(opt);
}
// width
if (width != 0)
doc->setTextWidth(width);
if (!elide)
doc->setHtml(text);
else
doc->setPlainText(elidedText);
// wrap mode
QTextOption opt;
opt.setWrapMode(elide ? QTextOption::NoWrap : QTextOption::WrapAtWordBoundaryOrAnywhere);
doc->setDefaultTextOption(opt);
// width
doc->setTextWidth(width);
doc->documentLayout()->update();
// update ascent