diff options
| author | Peter Penz <[email protected]> | 2007-01-26 19:58:41 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-01-26 19:58:41 +0000 |
| commit | d71de955f4a0901288d060a2eaceca305d11a203 (patch) | |
| tree | 5003c5120e0f3f903e020f59ba3c2b677e5ff556 | |
| parent | 9877bef7c56b07e715d1f7a6dddc8529387b689b (diff) | |
Further optimizations: do a delayed update of the geometry. This leads to a reduced flickering/resizing when e. g. the view is split or the window is resized.
svn path=/trunk/playground/utils/dolphin/; revision=627494
| -rw-r--r-- | src/statusbarmessagelabel.cpp | 12 | ||||
| -rw-r--r-- | src/statusbarmessagelabel.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/statusbarmessagelabel.cpp b/src/statusbarmessagelabel.cpp index de66bebba..1178a1688 100644 --- a/src/statusbarmessagelabel.cpp +++ b/src/statusbarmessagelabel.cpp @@ -79,7 +79,7 @@ void StatusBarMessageLabel::setType(DolphinStatusBar::Type type) } m_pixmap = (iconName == 0) ? QPixmap() : SmallIcon(iconName); - assureVisibleText(); + QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText())); update(); } } @@ -93,7 +93,7 @@ void StatusBarMessageLabel::setText(const QString& text) m_state = Illuminate; } m_text = text; - assureVisibleText(); + QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText())); update(); } } @@ -139,14 +139,18 @@ void StatusBarMessageLabel::paintEvent(QPaintEvent* /* event */) // draw text painter.setPen(foregroundColor); - painter.drawText(QRect(x, 0, width() - x, height()), Qt::AlignVCenter | Qt::TextWordWrap, m_text); + int flags = Qt::AlignVCenter; + if (height() > m_minTextHeight) { + flags = flags | Qt::TextWordWrap; + } + painter.drawText(QRect(x, 0, width() - x, height()), flags, m_text); painter.end(); } void StatusBarMessageLabel::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); - QTimer::singleShot(0, this, SLOT(assureVisibleText())); + QTimer::singleShot(GeometryTimeout, this, SLOT(assureVisibleText())); } void StatusBarMessageLabel::timerDone() diff --git a/src/statusbarmessagelabel.h b/src/statusbarmessagelabel.h index 922465584..03683c107 100644 --- a/src/statusbarmessagelabel.h +++ b/src/statusbarmessagelabel.h @@ -92,6 +92,8 @@ private: Desaturate }; + enum { GeometryTimeout = 100 }; + DolphinStatusBar::Type m_type; State m_state; int m_illumination; |
