[Kst] extragear/graphics/kst/src/libkstapp

George Staikos staikos at kde.org
Fri May 12 09:25:21 CEST 2006


SVN commit 539962 by staikos:

simplify this function, make it twice as fast on a large object tree, and fix a
bug it was masking (tracking the selection list).  Also remove unused variables
and use KstSharedPtr<>


 M  +6 -13     ksttoplevelview.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.cpp #539961:539962
@@ -373,7 +373,7 @@
     updateFocus(pos);
     paint(KstPainter::P_PAINT);
     return true;
-  } 
+  }
 
   if (_pressDirection == 0) {
     _moveOffset = pos - _pressTarget->position();
@@ -392,6 +392,7 @@
   if (!_selectionList.contains(_pressTarget)) {
     _selectionList.clear();
     recursively<bool>(&KstViewObject::setSelected, false);
+    _selectionList.append(_pressTarget);
   }
   _pressTarget->setSelected(true);
 
@@ -1600,21 +1601,13 @@
 
 
 void KstTopLevelView::deleteSelectedObjects() {
-  QValueList<KstViewObject*> toBeDeleted;
-
-  _selectionList.clear();
-  recursivelyQuery(&KstViewObject::isSelected, _selectionList, false);
-
-  KstViewObject *selection;
-  
-  while (!_selectionList.isEmpty()) {
-    selection = _selectionList.front();
-    
-    if (selection->parent()) {
+  for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
+    KstViewObjectPtr selection = *i;
+    if (selection && selection->parent()) {
       selection->parent()->removeChild(selection);
     }
-    _selectionList.pop_front();
   }
+  _selectionList.clear();
 
   clearFocus();
   paint(KstPainter::P_PAINT);


More information about the Kst mailing list