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

refactor(chat): cleanup elided text

This commit is contained in:
Nils Fenner 2016-07-12 10:06:17 +02:00
parent 939c97a0e9
commit b99a9e494a
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
2 changed files with 3 additions and 9 deletions

View File

@ -62,12 +62,6 @@ void Text::setWidth(qreal w)
width = w;
dirty = true;
if (elide)
{
QFontMetrics metrics = QFontMetrics(defFont);
elidedText = metrics.elidedText(text, Qt::ElideRight, width);
}
regenerate();
}
@ -256,6 +250,9 @@ void Text::regenerate()
}
else
{
QFontMetrics metrics = QFontMetrics(defFont);
QString elidedText = metrics.elidedText(rawText, Qt::ElideRight,
qRound(width));
doc->setPlainText(elidedText);
}

View File

@ -29,8 +29,6 @@ class QTextDocument;
class Text : public ChatLineContent
{
public:
// txt: may contain html code
// rawText: does not contain html code
Text(const QString& txt = "", const QFont& font = QFont(), bool enableElide = false, const QString& rawText = QString(), const QColor c = Qt::black);
virtual ~Text();
@ -75,7 +73,6 @@ private:
QTextDocument* doc = nullptr;
QString text;
QString rawText;
QString elidedText;
QString selectedText;
QSizeF size;
bool keepInMemory = false;