[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 13 00:44:40 CEST 2004


CVS commit by staikos: 

selection should be iterative over children, not recursive


  M +1 -1      ksttoplevelview.cpp   1.26
  M +12 -0     kstviewobject.h   1.19


--- kdeextragear-2/kst/kst/kstviewobject.h  #1.18:1.19
@@ -88,4 +88,5 @@ class KstViewObject : public KstObject {
     void recursively(void (KstViewObject::*)(), bool self = false);
     template<class T> void recursively(void (KstViewObject::*)(T), T, bool self = false);
+    template<class T> void forEachChild(void (KstViewObject::*)(T), T, bool self = false);
 
     virtual bool popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent);
@@ -140,4 +141,15 @@ class KstViewObject : public KstObject {
 
 template<class T>
+void KstViewObject::forEachChild(void (KstViewObject::*method)(T), T arg, bool self) {
+  if (self) {
+    (this->*method)(arg);
+  }
+  for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
+    ((*i)->*method)(arg);
+  }
+}
+
+
+template<class T>
 void KstViewObject::recursively(void (KstViewObject::*method)(T), T arg, bool self) {
   if (self) {

--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.25:1.26
@@ -473,5 +473,5 @@ void KstTopLevelView::releasePress(const
     p.drawWinFocusRect(_prevBand);
     p.end();
-    recursively<const QRect&>(&KstViewObject::updateSelection, _prevBand);
+    forEachChild<const QRect&>(&KstViewObject::updateSelection, _prevBand);
     _prevBand = QRect(-1, -1, 0, 0);
   }





More information about the Kst mailing list