1 #ifndef _ELLIPSIS_LABEL_H
2 #define _ELLIPSIS_LABEL_H 1
5 #include <QFontMetrics>
9 class EllipsisLabel : public QLabel {
13 EllipsisLabel(QWidget *parent) : QLabel(parent) {}
15 void setFullText(const QString &s)
22 void resizeEvent(QResizeEvent *event) override
24 QLabel::resizeEvent(event);
29 void updateEllipsisText()
31 QFontMetrics metrics(this->font());
32 this->setText(metrics.elidedText(full_text, Qt::ElideRight, this->width()));
38 #endif // !defined(_ELLIPSIS_LABEL_H)