From: Peter Penz Date: Tue, 23 Dec 2008 10:54:56 +0000 (+0000) Subject: assure that the zoom slider tooltip is always updated when changing a value X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/86ee6dbd07b42789676b8e7eee097104a93e8d54?ds=sidebyside assure that the zoom slider tooltip is always updated when changing a value svn path=/trunk/KDE/kdebase/apps/; revision=900577 --- diff --git a/src/dolphinstatusbar.cpp b/src/dolphinstatusbar.cpp index 597756d63..9d25eb103 100644 --- a/src/dolphinstatusbar.cpp +++ b/src/dolphinstatusbar.cpp @@ -74,6 +74,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent, DolphinView* view) : const int max = ZoomLevelInfo::maximumLevel(); m_zoomSlider->setRange(min, max); m_zoomSlider->setValue(view->zoomLevel()); + updateZoomSliderToolTip(); m_zoomIn = new QToolButton(m_zoomWidget); m_zoomIn->setIcon(KIcon("zoom-in")); @@ -242,6 +243,7 @@ void DolphinStatusBar::setZoomLevel(int zoomLevel) m_zoomOut->setEnabled(zoomLevel > m_zoomSlider->minimum()); m_zoomIn->setEnabled(zoomLevel < m_zoomSlider->maximum()); m_view->setZoomLevel(zoomLevel); + updateZoomSliderToolTip(); } void DolphinStatusBar::assureVisibleText() @@ -279,8 +281,6 @@ void DolphinStatusBar::zoomIn() void DolphinStatusBar::showZoomSliderToolTip(int zoomLevel) { - const int size = ZoomLevelInfo::iconSizeForZoomLevel(zoomLevel); - m_zoomSlider->setToolTip(i18ncp("@info:tooltip", "Size: 1 pixel", "Size: %1 pixels", size)); QPoint global = m_zoomSlider->rect().topLeft(); global.ry() += m_zoomSlider->height() / 2; QHelpEvent toolTipEvent(QEvent::ToolTip, QPoint(0, 0), m_zoomSlider->mapToGlobal(global)); @@ -301,4 +301,10 @@ void DolphinStatusBar::setExtensionsVisible(bool visible) m_zoomWidget->setVisible(zoomSliderVisible); } +void DolphinStatusBar::updateZoomSliderToolTip() +{ + const int size = ZoomLevelInfo::iconSizeForZoomLevel(m_view->zoomLevel()); + m_zoomSlider->setToolTip(i18ncp("@info:tooltip", "Size: 1 pixel", "Size: %1 pixels", size)); +} + #include "dolphinstatusbar.moc" diff --git a/src/dolphinstatusbar.h b/src/dolphinstatusbar.h index a5062928c..c6a2e8c43 100644 --- a/src/dolphinstatusbar.h +++ b/src/dolphinstatusbar.h @@ -116,7 +116,7 @@ public: */ void setDefaultText(const QString& text); const QString& defaultText() const; - + /** * Refreshes the status bar to get synchronized with the (updated) Dolphin settings. */ @@ -135,7 +135,7 @@ private slots: * content is updated. */ void updateSpaceInfoContent(const KUrl& url); - + /** * Sets the zoom level of the item view to \a zoomLevel. */ @@ -147,11 +147,11 @@ private slots: * enough width is available. */ void assureVisibleText(); - + void zoomOut(); void zoomIn(); void showZoomSliderToolTip(int zoomLevel); - + private: /** * Makes the space information widget and zoom slider widget @@ -161,11 +161,17 @@ private: */ void setExtensionsVisible(bool visible); + /** + * Updates the text of the zoom slider tooltip to show + * the currently used size. + */ + void updateZoomSliderToolTip(); + private: DolphinView* m_view; StatusBarMessageLabel* m_messageLabel; StatusBarSpaceInfo* m_spaceInfo; - + QWidget* m_zoomWidget; QToolButton* m_zoomOut; QSlider* m_zoomSlider;