Commit c5968b58 authored by Thomas Zander's avatar Thomas Zander

Various fixes for painting / updating nested shapes

svn path=/trunk/koffice/; revision=644220
parent 4b2845b0
......@@ -346,7 +346,22 @@ QMatrix KoShape::transformationMatrix(const KoViewConverter *converter) const {
bool KoShape::compareShapeZIndex(KoShape *s1, KoShape *s2) {
return s1->zIndex() < s2->zIndex();
int diff = s1->zIndex() - s2->zIndex();
if(diff == 0) {
KoShape *s = s1->parent();
while(s) {
if(s == s2) // s1 is a child of s2
return false; // children are always on top of their parents.
s = s->parent();
}
s = s2->parent();
while(s) {
if(s == s1) // s2 is a child of s1
return true;
s = s->parent();
}
}
return diff < 0;
}
void KoShape::setParent(KoShapeContainer *parent) {
......
......@@ -205,7 +205,8 @@ void KoShapeContainer::paint(QPainter &painter, const KoViewConverter &converter
void KoShapeContainer::shapeChanged(ChangeType type) {
if(d->children == 0)
return;
if(! (type == RotationChanged || type == ScaleChanged || type == ShearChanged || type == SizeChanged))
if(! (type == RotationChanged || type == ScaleChanged || type == ShearChanged
|| type == SizeChanged || type == PositionChanged))
return;
d->children->containerChanged(this);
foreach (KoShape *shape, d->children->iterator())
......
......@@ -325,6 +325,12 @@ void KoShapeManager::notifyShapeChanged( KoShape * shape )
return;
d->aggregate4update.insert( shape );
d->shapeIndexesBeforeUpdate.insert(shape, shape->zIndex());
KoShapeContainer *container = dynamic_cast<KoShapeContainer*> (shape);
if(container) {
foreach(KoShape *child, container->iterator())
d->aggregate4update.insert( child );
}
}
void KoShapeManager::updateTree()
......@@ -354,8 +360,10 @@ void KoShapeManager::updateTree()
QList<KoShape*> shapesWithCollisionDetection;
};
DetectCollision detector;
foreach ( KoShape *shape, d->aggregate4update )
detector.detect(d->tree, shape, d->shapeIndexesBeforeUpdate[shape]);
foreach ( KoShape *shape, d->aggregate4update ) {
if(d->shapeIndexesBeforeUpdate.contains(shape))
detector.detect(d->tree, shape, d->shapeIndexesBeforeUpdate[shape]);
}
foreach ( KoShape * shape, d->aggregate4update )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment