1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-13 18:42:11 +01:00
falkonOfficial/src/3rdparty/squeezelabelv2.cpp
nowrep 2cb067878d Coding style, fixed cppcheck warnings + improved html highlighter
- html highlighter is now highlighting with reg exps, no more with hard
coded tags/tag options
 - all cppecheck warnings fixed + added script (cppcheck.sh)
 - introduced coding style + added astyle script (coding_style.sh)
 - fixed one mistake in czech translate + updated windows installer
2011-11-06 17:01:23 +01:00

34 lines
727 B
C++

#include "squeezelabelv2.h"
SqueezeLabelV2::SqueezeLabelV2(QWidget* parent)
: QLabel(parent)
{
}
SqueezeLabelV2::SqueezeLabelV2(const QString &string)
: QLabel()
{
setText(string);
}
void SqueezeLabelV2::setText(const QString &txt)
{
m_originalText = txt;
QFontMetrics fm = fontMetrics();
QString elided = fm.elidedText(m_originalText, Qt::ElideMiddle, width());
QLabel::setText(elided);
}
QString SqueezeLabelV2::originalText()
{
return m_originalText;
}
void SqueezeLabelV2::resizeEvent(QResizeEvent* event)
{
QLabel::resizeEvent(event);
QFontMetrics fm = fontMetrics();
QString elided = fm.elidedText(m_originalText, Qt::ElideMiddle, width());
QLabel::setText(elided);
}