Bug 127177 - Delete keypresses sometimes do not work.
Summary: Delete keypresses sometimes do not work.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Duncan Hanson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-11 23:12 UTC by Duncan Hanson
Modified: 2006-05-12 02:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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);
 }