35 QMap<qreal, KoShape*> sortedPos;
39 Q_FOREACH (
KoShape *shape, shapes) {
41 switch (
d->distribute) {
43 sortedPos[bRect.center().x()] = shape;
47 sortedPos[bRect.left()] = shape;
48 extent += bRect.width();
51 sortedPos[bRect.right()] = shape;
54 sortedPos[bRect.center().y()] = shape;
58 sortedPos[bRect.bottom()] = shape;
59 extent += bRect.height();
62 sortedPos[bRect.top()] = shape;
66 KoShape* first = sortedPos.begin().value();
70 qreal space =
d->getAvailableSpace(first, last, extent, boundingRect);
71 qreal pos = 0.0, step = space / qreal(shapes.count() - 1);
77 QMapIterator<qreal, KoShape*> it(sortedPos);
78 while (it.hasNext()) {
80 position = it.value()->absolutePosition();
81 previousPositions << position;
83 bRect = it.value()->absoluteOutlineRect();
84 switch (
d->distribute) {
86 delta = QPointF(boundingRect.x() + first->
absoluteOutlineRect().width() / 2 + pos - bRect.width() / 2, bRect.y()) - bRect.topLeft();
89 delta = QPointF(boundingRect.left() + pos, bRect.y()) - bRect.topLeft();
93 delta = QPointF(boundingRect.left() + pos, bRect.y()) - bRect.topLeft();
96 delta = QPointF(boundingRect.left() + first->
absoluteOutlineRect().width() + pos - bRect.width(), bRect.y()) - bRect.topLeft();
99 delta = QPointF(bRect.x(), boundingRect.y() + first->
absoluteOutlineRect().height() / 2 + pos - bRect.height() / 2) - bRect.topLeft();
102 delta = QPointF(bRect.x(), boundingRect.top() + pos) - bRect.topLeft();
103 pos += bRect.height();
106 delta = QPointF(bRect.x(), boundingRect.top() + first->
absoluteOutlineRect().height() + pos - bRect.height()) - bRect.topLeft();
109 delta = QPointF(bRect.x(), boundingRect.top() + pos) - bRect.topLeft();
112 newPositions << position + delta;