Bug 127177

Summary: Delete keypresses sometimes do not work.
Product: [Applications] kst Reporter: Duncan Hanson <duncan.hanson>
Component: generalAssignee: Duncan Hanson <duncan.hanson>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Duncan Hanson 2006-05-11 23:12:15 UTC
Version:            (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources

Sometimes, when a viewobject is contained inside another viewobject the delete keystroke method does not work for removing it.

STEPS TO REPRODUCE:
1. create 2 rectangles.
2. place one of the rectangles inside the other.
3. switch to layout mode and put the focus on the inner rectangle. press the delete key. the delete will not happen, although it is expected.

The delete keystroke isn't being passed down by some parents? I will investigate.
Comment 1 Duncan Hanson 2006-05-12 02:47:25 UTC
SVN commit 539919 by dhanson:

BUG:127177 rewrote KstTopLevelView::deleteSelectedObjects so that deep children can be removed.

 M  +13 -9     ksttoplevelview.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.cpp #539918:539919
@@ -1601,18 +1601,22 @@
 
 void KstTopLevelView::deleteSelectedObjects() {
   QValueList<KstViewObject*> toBeDeleted;
-  for (KstViewObjectList::Iterator it = _children.begin(); it != _children.end(); ++it) {
-    if ((*it)->isSelected()) {
-      toBeDeleted.push_front(*it);
-    }  
-  }
+
+  _selectionList.clear();
+  recursivelyQuery(&KstViewObject::isSelected, _selectionList, false);
+
+  KstViewObject *selection;
   
-  clearFocus();
+  while (!_selectionList.isEmpty()) {
+    selection = _selectionList.front();
     
-  while (!toBeDeleted.isEmpty()) {
-    removeChild(toBeDeleted.front());
-    toBeDeleted.pop_front();  
+    if (selection->parent()) {
+      selection->parent()->removeChild(selection);
+    }
+    _selectionList.pop_front();
   }
+
+  clearFocus();
   paint(KstPainter::P_PAINT);
 }