From 9877bef7c56b07e715d1f7a6dddc8529387b689b Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 26 Jan 2007 19:38:32 +0000 Subject: Further optimizations for the status bar: hide the space information if the status bar text does not fit into the remaining width. svn path=/trunk/playground/utils/dolphin/; revision=627486 --- src/statusbarmessagelabel.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/statusbarmessagelabel.h') diff --git a/src/statusbarmessagelabel.h b/src/statusbarmessagelabel.h index 9aa8ac47d..922465584 100644 --- a/src/statusbarmessagelabel.h +++ b/src/statusbarmessagelabel.h @@ -37,8 +37,6 @@ class QTimer; * is shown in front of the text. For message texts having the type * DolphinStatusBar::Error a dynamic color blending is done to get the * attention from the user. - * - * @author Peter Penz */ class StatusBarMessageLabel : public QWidget { @@ -58,17 +56,34 @@ public: void setMinimumTextHeight(int min); int minimumTextHeight() const { return m_minTextHeight; } + /** + * Returns the gap of the width of the current set text to the + * width of the message label. A gap <= 0 means that the text + * fits into the available width. + */ + int widthGap() const; + protected: - /** @see QWidget::paintEvent */ + /** @see QWidget::paintEvent() */ virtual void paintEvent(QPaintEvent* event); - /** @see QWidget::resizeEvent */ + /** @see QWidget::resizeEvent() */ virtual void resizeEvent(QResizeEvent* event); private slots: void timerDone(); + + /** + * Increases the height of the message label so that + * the given text fits into given area. + */ void assureVisibleText(); + /** + * Returns the available width in pixels for the text. + */ + int availableTextWidth() const; + private: enum State { Default, -- cgit v1.3.1