1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Fixed SqueezeLabel

This commit is contained in:
nowrep 2011-05-25 14:30:43 +02:00
parent a71c0e073c
commit 41b992370b

View File

@ -8,7 +8,9 @@ SqueezeLabel::SqueezeLabel(QWidget *parent)
void SqueezeLabel::setText(const QString &txt)
{
m_originalText = txt;
QLabel::setText(txt);
QFontMetrics fm = fontMetrics();
QString elided = fm.elidedText(m_originalText, Qt::ElideMiddle, width());
QLabel::setText(elided);
}
QString SqueezeLabel::originalText()
@ -20,6 +22,6 @@ void SqueezeLabel::resizeEvent(QResizeEvent *event)
{
QLabel::resizeEvent(event);
QFontMetrics fm = fontMetrics();
QString elided = fm.elidedText(originalText(), Qt::ElideMiddle, width());
QString elided = fm.elidedText(m_originalText, Qt::ElideMiddle, width());
QLabel::setText(elided);
}