From kde-commits Wed Feb 16 08:56:16 2005 From: Mark Kretschmann Date: Wed, 16 Feb 2005 08:56:16 +0000 To: kde-commits Subject: kdeextragear-1/amarok/src/statusbar Message-Id: <20050216085616.819A31D20E () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=110854418507634 CVS commit by markey: Make tooltip for Random/Repeat always reflect current on/off state. CCMAIL: amarok-devel@lists.sf.net M +15 -7 toggleLabel.h 1.5 --- kdeextragear-1/amarok/src/statusbar/toggleLabel.h #1.4:1.5 @@ -50,11 +50,5 @@ public: setChecked( isChecked() ); - - QString tip = "
 "; - tip += action->isChecked() ? i18n("%2: on") : i18n("%2: off"); - tip += " "; - const QString path = KGlobal::iconLoader()->iconPath( action->icon(), -KIcon::SizeHuge ); - - QToolTip::add( this, tip.arg( path ).arg( action->text().remove('&') ) ); + setToolTip(); } @@ -80,5 +74,19 @@ public slots: { setPixmap( m_action->iconSet().pixmap( QIconSet::Small, on ? QIconSet::Normal : QIconSet::Disabled ) ); + setToolTip(); + } + +private: + void setToolTip() + { + QString tip = "
 "; + tip += m_action->isChecked() ? i18n("%2: on") : i18n("%2: off"); + tip += " "; + const QString path = KGlobal::iconLoader()->iconPath( m_action->icon(), -KIcon::SizeHuge ); + + QToolTip::remove( this ); + QToolTip::add( this, tip.arg( path ).arg( m_action->text().remove('&') ) ); } + };