[Kst] branches/work/kst/portto4/kst/src/libkstapp
Adam Treat
treat at kde.org
Sat Jun 9 00:28:31 CEST 2007
SVN commit 673076 by treat:
* Much better. We're going to draw our selection
ourselves I think...
M +15 -13 viewitem.cpp
M +2 -2 viewitem.h
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #673075:673076
@@ -53,7 +53,11 @@
#ifdef DEBUG_GEOMETRY
QColor semiRed(QColor(255, 0, 0, 50));
- painter->fillRect(boundingRect(), semiRed);
+ painter->save();
+ painter->resetTransform();
+ QRectF bound = mapToScene(boundingRect()).boundingRect();
+ painter->fillRect(bound, semiRed);
+ painter->restore();
#endif
QGraphicsRectItem::paint(painter, option, widget);
@@ -202,60 +206,60 @@
void ViewItem::setTopLeft(const QPointF &point) {
QRectF transformed = rect();
transformed.setTopLeft(point);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setTopRight(const QPointF &point) {
QRectF transformed = rect();
transformed.setTopRight(point);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setBottomLeft(const QPointF &point) {
QRectF transformed = rect();
transformed.setBottomLeft(point);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setBottomRight(const QPointF &point) {
QRectF transformed = rect();
transformed.setBottomRight(point);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setTop(qreal x) {
QRectF transformed = rect();
transformed.setTop(x);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setBottom(qreal x) {
QRectF transformed = rect();
transformed.setBottom(x);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setLeft(qreal x) {
QRectF transformed = rect();
transformed.setLeft(x);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
void ViewItem::setRight(qreal x) {
QRectF transformed = rect();
transformed.setRight(x);
- transformToRect(transformed, true);
+ transformToRect(transformed);
}
-bool ViewItem::transformToRect(const QRectF &newRect, bool combine) {
+bool ViewItem::transformToRect(const QRectF &newRect) {
/* setRect(newRect);*/
@@ -265,7 +269,7 @@
QPolygonF two(newRect);
two.pop_back(); //get rid of last closed point
bool success = QTransform::quadToQuad(one, two, t);
- if (success) setTransform(t, combine);
+ if (success) setTransform(t, true);
return success;
}
@@ -286,8 +290,6 @@
t.translate(origin.x(), origin.y());
t.rotate(angle);
t.translate(-origin.x(), -origin.y());
-
-// qDebug() << "rotateTowards" << corner << point << angle << endl;
setTransform(t, true);
}
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #673075:673076
@@ -19,7 +19,7 @@
#include "viewcommand.h"
#include "view.h" //forward declare, but enums??
-// #define DEBUG_GEOMETRY 1
+// #define DEBUG_GEOMETRY
namespace Kst {
@@ -54,7 +54,7 @@
void setBottom(qreal x);
void setLeft(qreal x);
void setRight(qreal x);
- bool transformToRect(const QRectF &newRect, bool combine = false);
+ bool transformToRect(const QRectF &newRect);
void rotateTowards(const QPointF &corner, const QPointF &point);
protected Q_SLOTS:
More information about the Kst
mailing list