diff --git a/src/chatlog/content/text.cpp b/src/chatlog/content/text.cpp index d23309f46..532a61b2f 100644 --- a/src/chatlog/content/text.cpp +++ b/src/chatlog/content/text.cpp @@ -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); } diff --git a/src/chatlog/content/text.h b/src/chatlog/content/text.h index b307fed13..354cbb746 100644 --- a/src/chatlog/content/text.h +++ b/src/chatlog/content/text.h @@ -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;