[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 6 08:43:56 CEST 2004


CVS commit by staikos: 

fix focus rect and child searching


  M +4 -1      ksttoplevelview.cpp   1.7
  M +8 -9      kstviewobject.cpp   1.9
  M +2 -13     kstviewobject.h   1.8


--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.6:1.7
@@ -94,5 +94,8 @@ void KstTopLevelView::updateFocus(const 
   KstViewObjectPtr p = findChild(pos);
   if (p) {
-    if (!p->focused() && _focusOn) {
+    if (p->focused()) {
+      return;
+    }
+    if (_focusOn) { // something else has the focus, clear it
       recursively<bool>(&KstViewObject::setFocus, false);
       _w->erase(); // FIXME: optimize to reduce flicker

--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.8:1.9
@@ -83,5 +83,5 @@ void KstViewObject::paint(QPainter& p) {
     r.setWidth(_size.width() + 8);
     r.setHeight(_size.height() + 8);
-    p.drawRect(r);
+    p.drawWinFocusRect(r);
   }
 }
@@ -254,18 +254,17 @@ void KstViewObject::recursively(void (Ks
 
 KstViewObjectPtr KstViewObject::findChild(const QPoint& pos) {
-  if (QRect(_pos, _size).contains(pos)) {
-    return this;
+  kdDebug() << "Searching for child at " << pos << endl;
+  if (!QRect(_pos, _size).contains(pos)) {
+    return KstViewObjectPtr();
   }
 
-  KstViewObjectPtr p;
-
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-    p = (*i)->findChild(pos);
-    if (p) {
-      break;
+    kdDebug() << " ->Comparing against " << (*i)->position() << endl;
+    if (QRect((*i)->position(), (*i)->size()).contains(pos)) {
+      return *i;
     }
   }
 
-  return p;
+  return KstViewObjectPtr();
 }
 

--- kdeextragear-2/kst/kst/kstviewobject.h  #1.7:1.8
@@ -107,17 +107,6 @@ void KstViewObject::recursively(void (Ks
 template<class T>
 KstViewObjectPtr KstViewObject::findChildType(const QPoint& pos) {
-  if (QRect(_pos, _size).contains(pos) && dynamic_cast<T*>(this)) {
-    return this;
-  }
-
-  KstViewObjectPtr p;
-  for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-    p = (*i)->findChildType<T>(pos);
-    if (p) {
-      break;
-    }
-  }
-
-  return p;
+  // FIXME
+  return KstViewObjectPtr();
 }
 





More information about the Kst mailing list