]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/ktooltip.cpp
use a smaller step size when using the scroll wheel
[dolphin.git] / src / ktooltip.cpp
index bf607d0ecf8219fdd79ff1961e92e68c861ecb97..a0126fbffecdcc976660dd64b266aebcd3ab14ef 100644 (file)
 #include "ktooltip_p.h"
 
 
+// compile with XShape older than 1.0
+#ifndef ShapeInput
+const int ShapeInput = 2;
+#endif
+
 
 class KToolTipItemPrivate
 {
@@ -64,6 +69,7 @@ KToolTipItem::KToolTipItem(const QIcon &icon, const QString &text, int type)
 
 KToolTipItem::~KToolTipItem()
 {
+    delete d;
 }
 
 int KToolTipItem::type() const
@@ -89,6 +95,7 @@ QVariant KToolTipItem::data(int role) const
 void KToolTipItem::setData(int role, const QVariant &data)
 {
     d->map[role] = data;
+    KToolTipManager::instance()->update();
 }
 
 
@@ -143,11 +150,7 @@ void KToolTipDelegate::paint(QPainter *painter, const KStyleOptionToolTip *optio
     else
         path.addRect(option->rect.adjusted(0, 0, -1, -1));
 
-#if QT_VERSION >= 0x040400
     QColor color = option->palette.color(QPalette::ToolTipBase);
-#else
-    QColor color = option->palette.color(QPalette::Base);
-#endif
     QColor from = color.lighter(105);
     QColor to   = color.darker(120);
 
@@ -417,7 +420,7 @@ void ArgbLabel::hideTip()
 KToolTipManager *KToolTipManager::s_instance = 0;
 
 KToolTipManager::KToolTipManager()
-       : label(0), currentItem(0)
+       : label(0), currentItem(0), m_delegate(0)
 {
 #ifdef Q_WS_X11
     Display *dpy      = QX11Info::display();
@@ -465,6 +468,7 @@ void KToolTipManager::showTip(const QPoint &pos, KToolTipItem *item)
     hideTip();
     label->showTip(pos, item);
     currentItem = item;
+    m_tooltipPos = pos;
 }
 
 void KToolTipManager::hideTip()
@@ -503,6 +507,13 @@ void KToolTipManager::setDelegate(KToolTipDelegate *delegate)
     m_delegate = delegate;
 }
 
+void KToolTipManager::update()
+{
+    if (currentItem == 0)
+        return;
+    label->showTip(m_tooltipPos, currentItem);
+}
+
 KToolTipDelegate *KToolTipManager::delegate() const
 {
     return m_delegate;