Version: HEAD (using KDE KDE 3.5.0) Installed from: Compiled From Sources OS: Linux PROBLEM: If the user tries to create plot groups made of other plot groups then the lower level plot groups are automatically destroyed STEPS TO REPRODUCE: Start Kst In the default window create 3 rectangle objects Enter layout mode Select 2 of the rectangle objects Group them Select the newly created group and the third rectangle Group them Try to the newly created group RESULTS: The newly created plot group is destroyed EXPECTED RESULTS: The newly created plot group continues to exist
This problem seems to be caused by the following lines of code in KstToplevelView::releasePressLayoutModeMove(...) if (container != _pressTarget && !container->children().contains(_pressTarget)) { _pressTarget->detach(); container->appendChild(_pressTarget); } which implicitly moves objects from a deeper group up to a higher level. This appears related to the automated parenting of objects following a move, but in this case no move was made. One solution would be to disable a move operation for objects within a plot group. Only the group could be moved as a whole. However, we might still want to be able to edit an object within a plot group.
I don't think that's the case. I think we're getting the wrong target to begin with. It's because of a change I made to plotgroups to fix some other problems. I didn't notice the impact here. I'm testing a patch now.
SVN commit 526966 by staikos: don't break plot groups apart. There are still many problems lurking though. BUG: 124453 M +6 -4 ksttoplevelview.cpp --- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.cpp #526965:526966 @@ -330,11 +330,13 @@ _pressTarget = findDeepestChild(pos, false); if (_pressTarget) { KstViewObjectPtr p = _pressTarget; - while (p->_parent && p->_parent->_container) { + while (p->_parent && (p->_parent->_container || kst_cast<KstPlotGroup>((KstViewObjectPtr)p->_parent)) && !kst_cast<KstTopLevelView>((KstViewObjectPtr)p->_parent)) { p = p->_parent; } - if (p->_parent && !p->_parent->_container) { + if (p->_parent && !p->_parent->_container && !kst_cast<KstTopLevelView>((KstViewObjectPtr)p->_parent)) { _pressTarget = p->_parent; + } else if (p && !p->_container) { + _pressTarget = p; } } @@ -957,10 +959,10 @@ obj = obj.unite((*i)->geometry()); } } - const QPoint objOffset(_pressTarget->geometry().topLeft() - obj.topLeft()); + const QPoint objOffset(old.topLeft() - obj.topLeft()); // do the move - obj.moveTopLeft(pos - _moveOffset - _moveOffsetSticky - _pressTarget->geometry().topLeft() + obj.topLeft()); + obj.moveTopLeft(pos - _moveOffset - _moveOffsetSticky - old.topLeft() + obj.topLeft()); if (!_geom.contains(obj, true)) { slideInto(_geom, obj); }