Commit b9a7dd7e authored by Thomas Zander's avatar Thomas Zander

When setting a border we should draw it.

svn path=/trunk/koffice/; revision=995725
parent 02f850b5
......@@ -120,6 +120,26 @@ void KoShapePrivate::shapeChanged(KoShape::ChangeType type)
shape->shapeChanged(type, q);
}
void KoShapePrivate::updateBorder()
{
if (border == 0)
return;
KoInsets insets;
border->borderInsets(q, insets);
QSizeF inner = q->size();
// update left
q->update(QRectF(-insets.left, -insets.top, insets.left,
inner.height() + insets.top + insets.bottom));
// update top
q->update(QRectF(-insets.left, -insets.top,
inner.width() + insets.left + insets.right, insets.top));
// update right
q->update(QRectF(inner.width(), -insets.top, insets.right,
inner.height() + insets.top + insets.bottom));
// update bottom
q->update(QRectF(-insets.left, inner.height(),
inner.width() + insets.left + insets.right, insets.bottom));
}
// ======== KoShape
KoShape::KoShape()
......@@ -762,11 +782,13 @@ KoShapeBorderModel *KoShape::border() const
void KoShape::setBorder(KoShapeBorderModel *border)
{
Q_D(KoShape);
d->updateBorder();
if (d->border)
d->border->removeUser();
d->border = border;
if (d->border)
d->border->addUser();
d->updateBorder();
d->shapeChanged(BorderChanged);
notifyChanged();
}
......@@ -777,8 +799,10 @@ void KoShape::setShadow(KoShapeShadow * shadow)
if (d->shadow)
d->shadow->removeUser();
d->shadow = shadow;
if (d->shadow)
if (d->shadow) {
d->shadow->addUser();
// TODO update changed area
}
d->shapeChanged(ShadowChanged);
notifyChanged();
}
......
......@@ -32,6 +32,9 @@ public:
*/
void shapeChanged(KoShape::ChangeType type);
/// calls update on the shape where the border is.
void updateBorder();
QSizeF size; // size in pt
QString shapeId;
QString name; ///< the shapes names
......
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