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:
parent
217716184b
commit
24bccb7bdd
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user