aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-23 12:15:33 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-23 12:15:33 (GMT)
commit430985175bfb26b4d30e7850e2db472baf30c250 (patch)
tree92a320f035659c272e5a0c2bb47c09aad83b96e1
parent4e056f9a29768b4e9cab73572ad038c8078638c9 (diff)
elide too long text
-rw-r--r--kate/app/katetabbutton.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/kate/app/katetabbutton.cpp b/kate/app/katetabbutton.cpp
index c727706..83bd2f1 100644
--- a/kate/app/katetabbutton.cpp
+++ b/kate/app/katetabbutton.cpp
@@ -95,8 +95,9 @@ void KateTabButton::paintEvent(QPaintEvent *ev)
p.fillRect(rect(), c.lighter(110));
}
- // draw text
- style()->drawItemText(&p, rect(), Qt::AlignHCenter | Qt::AlignVCenter, pal, true, text());
+ // draw text, we need to elide to xxx...xxx is too long
+ const QString elidedText = QFontMetrics(font()).elidedText (text(), Qt::ElideMiddle, rect().width());
+ style()->drawItemText(&p, rect(), Qt::AlignHCenter | Qt::AlignVCenter, pal, true, elidedText);
if (m_highlightColor.isValid()) {
p.fillRect(QRect(0, height() - 3, width(), 10), m_highlightColor);