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

List:       kde-commits
Subject:    playground/utils/filelight/src/part/radialMap
From:       Martin Tobias Holmedahl Sandsmark <sandsmark () samfundet ! no>
Date:       2009-05-12 18:21:43
Message-ID: 1242152503.324772.25935.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 967160 by sandsmark:

Handle events in the tooltips a bit differently, fix the redrawing of the tooltips properly.



 M  +18 -25    segmentTip.cpp  
 M  +5 -1      segmentTip.h  
 M  +1 -3      widgetEvents.cpp  


--- trunk/playground/utils/filelight/src/part/radialMap/segmentTip.cpp #967159:967160
@@ -121,36 +121,11 @@
 }
 
 bool
-SegmentTip::event(QEvent *e)
-{
-    switch (e->type())
-    {
-    case QEvent::Show:
-        kapp->installEventFilter(this);
-        break;
-    case QEvent::Hide:
-        kapp->removeEventFilter(this);
-        break;
-    case QEvent::Paint:
-    {
-        QPainter(this).drawPixmap(0, 0, m_pixmap);
-        return true;
-    }
-    default:
-        ;
-    }
-
-    return false;
-}
-
-bool
 SegmentTip::eventFilter(QObject*, QEvent *e)
 {
     switch (e->type())
     {
     case QEvent::Leave:
-//     case QEvent::MouseButtonPress:
-//     case QEvent::MouseButtonRelease:
     case QEvent::KeyPress:
     case QEvent::KeyRelease:
     case QEvent::FocusIn:
@@ -162,5 +137,23 @@
     }
 }
 
+void
+SegmentTip::paintEvent(QPaintEvent*)
+{
+    QPainter(this).drawPixmap(0, 0, m_pixmap);
+}
+
+void
+SegmentTip::hideEvent(QHideEvent*)
+{
+    kapp->removeEventFilter(this);
+}
+
+void
+SegmentTip::showEvent(QShowEvent*)
+{
+    kapp->installEventFilter(this);
+}
+
 } //namespace RadialMap
 
--- trunk/playground/utils/filelight/src/part/radialMap/segmentTip.h #967159:967160
@@ -40,8 +40,12 @@
 
 private:
     virtual bool eventFilter(QObject*, QEvent*);
-    virtual bool event(QEvent*);
 
+protected:
+    void paintEvent(QPaintEvent *event);
+    void hideEvent(QHideEvent*);
+    void showEvent(QShowEvent*);
+
     uint    m_cursorHeight;
     QPixmap m_pixmap;
     QString m_text;
--- trunk/playground/utils/filelight/src/part/radialMap/widgetEvents.cpp #967159:967160
@@ -147,12 +147,10 @@
         {
             setCursor(Qt::PointingHandCursor);
 
-            m_tip->hide(); //HACK: hack to force tooltip to be updated.
             m_tip->updateTip(m_focus->file(), m_tree);
-            m_tip->show(); //HACK: repaint(), update() et al doesn't work.
 
             emit mouseHover(m_focus->file()->fullPath());
-            update();
+            m_tip->update();
         }
         m_tip->moveTo(e->globalPos(), (p.y() < 0));
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

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