[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdenonbeta/kdedebian/kapture/libkapture



CVS commit by mornfall: 

First iteration of ListTreeWidget tooltips. Works, just needs tooltip
content. Try to make this reusable ;).


  M +13 -0     listtreewidget.cpp   1.24
  M +13 -0     listtreewidget.h   1.16


--- kdenonbeta/kdedebian/kapture/libkapture/listtreewidget.cpp  #1.23:1.24
@@ -156,4 +156,5 @@ ListTreeWidget::ListTreeWidget (QWidget 
     connect (this, SIGNAL (collapsed (QListViewItem *)),
             SLOT (nodeClosed (QListViewItem *)));
+    m_tip = new ListTreeWidgetTooltip (viewport (), this);
 }
                                                                     /* }}} */
@@ -162,4 +163,5 @@ ListTreeWidget::ListTreeWidget (QWidget 
 ListTreeWidget::~ListTreeWidget()
 {
+    delete m_tip;
 }
                                                                     /* }}} */
@@ -252,3 +254,14 @@ void ListTreeWidget::forwardSelectionCha
                                                                     /* }}} */
 
+void ListTreeWidgetTooltip::maybeTip (const QPoint &p)
+{
+    if (! m_parent)
+        return;
+    std::cerr << "ListTreeWidgetTooltip::maybeTip ()" << std::endl;
+    KListViewItemCustom *i = dynamic_cast <KListViewItemCustom *> (m_parent ->
+            itemAt (p));
+    if (i)
+        tip (m_parent -> itemRect (i), i -> m_treeNode -> id ());
+}
+
 #include "listtreewidget.moc"

--- kdenonbeta/kdedebian/kapture/libkapture/listtreewidget.h  #1.15:1.16
@@ -13,4 +13,5 @@
 
 #include <klistview.h>
+#include <qtooltip.h>
 #include <libcapture/tree.h>
 #include <libcapture/treenode.h>
@@ -27,4 +28,5 @@ namespace kapture {
     using namespace capture;
     class KListViewItemCustom;
+    class ListTreeWidgetTooltip;
 
     // class ListTreeWidget                                            {{{
@@ -48,4 +50,15 @@ namespace kapture {
         protected:
             std::set <std::string> m_open;
+            ListTreeWidgetTooltip *m_tip;
+    };
+                                                                    /* }}} */
+    // ListTreeWidgetTooltip                                           {{{
+    class ListTreeWidgetTooltip : public QToolTip
+    {
+        public:
+            ListTreeWidgetTooltip (QWidget *v, ListTreeWidget *p) : QToolTip (v, 0), m_parent (p) {};
+        protected:
+            virtual void maybeTip (const QPoint &p);
+            ListTreeWidget *m_parent;
     };
                                                                     /* }}} */




Reply to: