Browse Source

refactor(chat): cleanup elided text

pull/3502/head
Nils Fenner 9 years ago
parent
commit
b99a9e494a
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
  1. 9
      src/chatlog/content/text.cpp
  2. 3
      src/chatlog/content/text.h

9
src/chatlog/content/text.cpp

@ -62,12 +62,6 @@ void Text::setWidth(qreal w) @@ -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() @@ -256,6 +250,9 @@ void Text::regenerate()
}
else
{
QFontMetrics metrics = QFontMetrics(defFont);
QString elidedText = metrics.elidedText(rawText, Qt::ElideRight,
qRound(width));
doc->setPlainText(elidedText);
}

3
src/chatlog/content/text.h

@ -29,8 +29,6 @@ class QTextDocument; @@ -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: @@ -75,7 +73,6 @@ private:
QTextDocument* doc = nullptr;
QString text;
QString rawText;
QString elidedText;
QString selectedText;
QSizeF size;
bool keepInMemory = false;

Loading…
Cancel
Save