Summary: | ellipse fails to clip child objects | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Andrew Walker
2006-03-13 19:23:28 UTC
I think this behaves as expected. If it is a child of the ellipse, it should only be inside the ellipse, not inside the ellipse's bounding box. What may be a problem is that it should not be allowed to be a child if it doesn't fit entirely within the ellipse. This makes the problem of a transparent disjoint object tricky to solve though. If the window is forced to update (by resizing the window for example) then the rectangle is drawn in full. I suspect that this is what the code is trying to do, but the initial paint is incomplete. Further if the rectangle is moved (after the window is resized) the portion of the rectangle outside of the ellipse is not erased (until the window is resized again). ah I see, so the clipping eventually fails. See also related bug reports #121068 and #143806 SVN commit 666734 by arwalker: BUG:123561 Invalidate the clipping region for the object being moved and its old parent so that both are redrawn correctly. M +8 -3 ksttoplevelview.cpp --- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #666733:666734 @@ -988,7 +988,7 @@ // we are resizing rectangular object(s) releasePressLayoutModeResize(pos, shift); } - _pressTarget->setFocus(true); + _pressTarget->setFocus(true); } else { // selecting objects using rubber band releasePressLayoutModeSelect(pos, shift); @@ -1026,12 +1026,15 @@ // the returned object in that case. KstViewObjectPtr container = findDeepestChild(obj); bool updateViewManager = false; - + if (!container) { container = this; } if (container != _pressTarget && !container->children().contains(_pressTarget)) { - _pressTarget->detach(); + if (_pressTarget->parent()) { + _pressTarget->parent()->invalidateClipRegion(); + _pressTarget->detach(); + } container->appendChild(_pressTarget); updateViewManager = true; } @@ -1047,10 +1050,12 @@ thisObj->move(_pressTarget->position() + thisObj->geometry().topLeft() - old.topLeft()); } } + container->invalidateClipRegion(); if (updateViewManager) { KstApp::inst()->updateViewManager(true); } + _onGrid = false; } SVN commit 705903 by arwalker: CCBUG:123561 ensure clip region is correctly updated after deleting objects via the shortcut M +2 -0 ksttoplevelview.cpp M +1 -1 kstviewellipse.cpp M +9 -1 kstviewobject.cpp --- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #705902:705903 @@ -1860,7 +1860,9 @@ void KstTopLevelView::deleteSelectedObjects() { for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) { KstViewObjectPtr selection = *i; + if (selection && selection->parent()) { + selection->parent()->invalidateClipRegion(); selection->parent()->removeChild(selection); } } --- branches/work/kst/1.5/kst/src/libkstapp/kstviewellipse.cpp #705902:705903 @@ -230,4 +230,4 @@ #include "kstviewellipse.moc" -// vim: ts=2 sw=2 et + --- branches/work/kst/1.5/kst/src/libkstapp/kstviewobject.cpp #705902:705903 @@ -307,12 +307,14 @@ void KstViewObject::paint(KstPainter& p, const QRegion& bounds) { bool maximized = false; + if (p.type() == KstPainter::P_EXPORT || p.type() == KstPainter::P_PRINT) { // handle the case where we have maximized plots for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) { if ((*i)->_maximized) { (*i)->paint(p, bounds); maximized = true; + break; } } @@ -323,6 +325,7 @@ (*i)->paint(p, bounds); } } + return; } @@ -346,12 +349,14 @@ if ((*i)->_maximized) { (*i)->paint(p, bounds); maximized = true; + break; } } if (!maximized) { QRegion clipRegion; + if (nullBounds) { clipRegion = geometry(); } else { @@ -362,6 +367,7 @@ KstViewObjectList::Iterator begin = _children.begin(); for (KstViewObjectList::Iterator i = _children.fromLast();; --i) { const QRegion thisObjectGeometry((*i)->geometry()); + if (nullBounds || !clipRegion.intersect(thisObjectGeometry).isEmpty()) { #ifdef BENCHMARK QTime t; @@ -1305,14 +1311,16 @@ if (_topObjectForMenu) { KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(KstViewObjectPtr(_topObjectForMenu)); + if (tlv && vop == tlv->pressTarget()) { tlv->clearPressTarget(); } + if (this->_parent) { this->_parent->invalidateClipRegion(); } + _topObjectForMenu->removeChild(this, true); - _topObjectForMenu = 0L; } SVN commit 706597 by arwalker: CCBUG:123561 Also fix the same problem for resizing objects M +6 -2 ksttoplevelview.cpp --- branches/work/kst/1.5/kst/src/libkstapp/ksttoplevelview.cpp #706596:706597 @@ -988,8 +988,13 @@ // we are resizing rectangular object(s) releasePressLayoutModeResize(pos, shift); } + + if (_pressTarget->parent()) { + _pressTarget->parent()->invalidateClipRegion(); + } + _pressTarget->setFocus(true); - } else { + } else { // selecting objects using rubber band releasePressLayoutModeSelect(pos, shift); } @@ -1050,7 +1055,6 @@ thisObj->move(_pressTarget->position() + thisObj->geometry().topLeft() - old.topLeft()); } } - container->invalidateClipRegion(); if (updateViewManager) { KstApp::inst()->updateViewManager(true); |