[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Thu Jun 7 22:03:59 CEST 2007
SVN commit 672659 by treat:
* Actually scale VS resizing. Check out what
this does to our labels :)
M +21 -4 viewitem.cpp
M +1 -0 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #672658:672659
@@ -123,7 +123,8 @@
} else {
transformed.setBottomRight(event->pos());
}
- setRect(transformed);
+/* setRect(transformed);*/
+ transformToRect(transformed);
return;
}
case Qt::SizeBDiagCursor:
@@ -134,7 +135,8 @@
} else {
transformed.setTopRight(event->pos());
}
- setRect(transformed);
+/* setRect(transformed);*/
+ transformToRect(transformed);
return;
}
case Qt::SizeVerCursor:
@@ -145,7 +147,8 @@
} else {
transformed.setBottom(event->pos().y());
}
- setRect(transformed);
+/* setRect(transformed);*/
+ transformToRect(transformed);
return;
}
case Qt::SizeHorCursor:
@@ -156,7 +159,9 @@
} else {
transformed.setRight(event->pos().x());
}
- setRect(transformed);
+/* setRect(transformed);*/
+ transformToRect(transformed);
+
return;
}
case Qt::ArrowCursor:
@@ -168,6 +173,18 @@
}
+bool ViewItem::transformToRect(const QRectF &newRect) {
+ QTransform t;
+ QPolygonF one(rect());
+ one.pop_back(); //get rid of last closed point
+ QPolygonF two(newRect);
+ two.pop_back(); //get rid of last closed point
+ bool success = QTransform::quadToQuad(one, two, t);
+ if (success) setTransform(t, true);
+ return success;
+}
+
+
void ViewItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
QGraphicsRectItem::mousePressEvent(event);
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #672658:672659
@@ -39,6 +39,7 @@
void removeItem();
void zOrderUp();
void zOrderDown();
+ bool transformToRect(const QRectF &newRect);
protected Q_SLOTS:
virtual void creationPolygonChanged(View::CreationEvent event);
More information about the Kst
mailing list