diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtElidingLabel.cpp | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtElidingLabel.h | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Swift/QtUI/QtElidingLabel.cpp b/Swift/QtUI/QtElidingLabel.cpp index 90483f5..f5a39f0 100644 --- a/Swift/QtUI/QtElidingLabel.cpp +++ b/Swift/QtUI/QtElidingLabel.cpp @@ -1,10 +1,10 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include "Swift/QtUI/QtElidingLabel.h" +#include <Swift/QtUI/QtElidingLabel.h> namespace Swift { QtElidingLabel::QtElidingLabel(QWidget* parent, Qt::WindowFlags f) : QLabel(parent, f) { @@ -25,6 +25,10 @@ QtElidingLabel::~QtElidingLabel() { } +QSize QtElidingLabel::sizeHint() const { + return sizeHint_; +} + void QtElidingLabel::setSizes() { setMinimumSize(1, minimumHeight()); } @@ -32,6 +36,7 @@ void QtElidingLabel::setSizes() { void QtElidingLabel::setText(const QString& text) { fullText_ = text; QLabel::setText(text); + sizeHint_ = QLabel::sizeHint(); dirty_ = true; } diff --git a/Swift/QtUI/QtElidingLabel.h b/Swift/QtUI/QtElidingLabel.h index 4d0be95..84fa00f 100644 --- a/Swift/QtUI/QtElidingLabel.h +++ b/Swift/QtUI/QtElidingLabel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,6 +17,8 @@ namespace Swift { void setText(const QString& text); virtual ~QtElidingLabel(); + virtual QSize sizeHint() const; + virtual void paintEvent(QPaintEvent* event); private: @@ -24,5 +26,6 @@ namespace Swift { bool dirty_; QString fullText_; QRect lastRect_; + QSize sizeHint_; }; } |