mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Fixed SqueezeLabel
This commit is contained in:
parent
a71c0e073c
commit
41b992370b
6
src/3rdparty/squeezelabel.cpp
vendored
6
src/3rdparty/squeezelabel.cpp
vendored
|
@ -8,7 +8,9 @@ SqueezeLabel::SqueezeLabel(QWidget *parent)
|
||||||
void SqueezeLabel::setText(const QString &txt)
|
void SqueezeLabel::setText(const QString &txt)
|
||||||
{
|
{
|
||||||
m_originalText = 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()
|
QString SqueezeLabel::originalText()
|
||||||
|
@ -20,6 +22,6 @@ void SqueezeLabel::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QLabel::resizeEvent(event);
|
QLabel::resizeEvent(event);
|
||||||
QFontMetrics fm = fontMetrics();
|
QFontMetrics fm = fontMetrics();
|
||||||
QString elided = fm.elidedText(originalText(), Qt::ElideMiddle, width());
|
QString elided = fm.elidedText(m_originalText, Qt::ElideMiddle, width());
|
||||||
QLabel::setText(elided);
|
QLabel::setText(elided);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user