diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-08-27 13:59:58 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-08-27 13:59:58 (GMT) |
commit | 02e1f82cd154030ea44608d90c7241a0ba8c1795 (patch) | |
tree | 82227a1ac31b651fc43559eeec648d2b47a7c622 | |
parent | 0571ecb72660dbdbe06d524eb62e5398dca45586 (diff) | |
download | swift-contrib-02e1f82cd154030ea44608d90c7241a0ba8c1795.zip swift-contrib-02e1f82cd154030ea44608d90c7241a0ba8c1795.tar.bz2 |
Don't elide roster headings when the widget becomes large enough.
Resolves: #544
-rw-r--r-- | Swift/QtUI/QtElidingLabel.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/QtElidingLabel.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Swift/QtUI/QtElidingLabel.cpp b/Swift/QtUI/QtElidingLabel.cpp index 475aa3b..3d53006 100644 --- a/Swift/QtUI/QtElidingLabel.cpp +++ b/Swift/QtUI/QtElidingLabel.cpp @@ -38,9 +38,12 @@ void QtElidingLabel::paintEvent(QPaintEvent* event) { dirty_ = dirty_ || rect != lastRect_; if (dirty_) { lastRect_ = rect; - if (fontMetrics().width(fullText_) > rect.width()) { + int fontWidth = fontMetrics().width(fullText_); + if (fontWidth > rect.width()) { QString elidedText(fontMetrics().elidedText(fullText_, Qt::ElideRight, rect.width(), Qt::TextShowMnemonic)); QLabel::setText(elidedText); + } else { + QLabel::setText(fullText_); } dirty_ = false; } diff --git a/Swift/QtUI/QtElidingLabel.h b/Swift/QtUI/QtElidingLabel.h index 79701ec..0bf2231 100644 --- a/Swift/QtUI/QtElidingLabel.h +++ b/Swift/QtUI/QtElidingLabel.h @@ -18,6 +18,7 @@ namespace Swift { virtual ~QtElidingLabel(); virtual void paintEvent(QPaintEvent* event); + private: void setSizes(); bool dirty_; |