summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtElidingLabel.cpp')
-rw-r--r--Swift/QtUI/QtElidingLabel.cpp5
1 files changed, 4 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;
}