[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Nicer what's this help
From:       Bernd Gehrmann <bernd () physik ! hu-berlin ! de>
Date:       2001-10-28 22:32:58
[Download RAW message or body]

This patch adds an action's icon to its what's this
help. Helps to memorize the icon associated with an
action. Any objections to commiting this?

Bernd.


["patch" (TEXT/PLAIN)]

Index: kaction.h
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kaction.h,v
retrieving revision 1.113
diff -u -r1.113 kaction.h
--- kaction.h	2001/10/26 21:52:58	1.113
+++ kaction.h	2001/10/28 22:29:02
@@ -526,6 +526,7 @@
     void enabled( bool );
 
 private:
+    QString whatsThisWithIcon() const;
     class KActionPrivate;
     KActionPrivate *d;
 };
Index: kaction.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kaction.cpp,v
retrieving revision 1.195
diff -u -r1.195 kaction.cpp
--- kaction.cpp	2001/10/10 17:40:38	1.195
+++ kaction.cpp	2001/10/28 22:29:05
@@ -448,7 +448,7 @@
         menu->setItemEnabled( id, false );
 
     if ( !d->m_whatsThis.isEmpty() )
-        menu->setWhatsThis( id, d->m_whatsThis );
+        menu->setWhatsThis( id, whatsThisWithIcon() );
 
     addContainer( menu, id );
     connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
@@ -485,7 +485,7 @@
     }
 
     if ( !d->m_whatsThis.isEmpty() )
-        QWhatsThis::add( bar->getButton(id_), d->m_whatsThis );
+        QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() );
 
     if ( !d->m_toolTip.isEmpty() )
       QToolTip::add( bar->getButton(id_), d->m_toolTip );
@@ -757,6 +757,14 @@
 QString KAction::whatsThis() const
 {
   return d->m_whatsThis;
+}
+
+QString KAction::whatsThisWithIcon() const
+{
+    QString text = whatsThis();
+    if (!d->m_iconName.isEmpty())
+      return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->m_iconName).arg(text);
+    return text;
 }
 
 QPixmap KAction::pixmap() const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic