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:
parent
939c97a0e9
commit
b99a9e494a
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user