svn path=/trunk/KDE/kdelibs/; revision=1050130
This commit is contained in:
Marco Martin 2009-11-16 18:20:18 +00:00
parent c80e22969c
commit 644d5e363e

View File

@ -743,29 +743,29 @@ bool AppletHandle::sceneEvent(QEvent *event)
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
//rotation
QLineF line0(touchPoint0.lastScenePos(), touchPoint1.lastScenePos());
//rotation
QLineF line0(touchPoint0.lastScenePos(), touchPoint1.lastScenePos());
QLineF line1(touchPoint0.scenePos(), touchPoint1.scenePos());
//m_applet->setTransformOriginPoint(m_applet->boundingRect().center());
m_angle = m_applet->rotation()+line1.angleTo(line0);
m_angle = m_applet->rotation()+line1.angleTo(line0);
//m_applet->setRotation(m_angle);
//m_applet->setTransformOriginPoint(QPointF(0,0));
QTransform t = m_applet->transform();
t.translate(m_applet->size().width()/2, m_applet->size().height()/2);
t.rotate(m_angle);
t.translate(-m_applet->size().width()/2, -m_applet->size().height()/2);
m_applet->setTransform(t);
QTransform t = m_applet->transform();
t.translate(m_applet->size().width()/2, m_applet->size().height()/2);
t.rotate(m_angle);
t.translate(-m_applet->size().width()/2, -m_applet->size().height()/2);
m_applet->setTransform(t);
//scaling
qreal scaleFactor = 1;
if (line0.length() > 0) {
scaleFactor = line1.length() / line0.length();
//scaling
qreal scaleFactor = 1;
if (line0.length() > 0) {
scaleFactor = line1.length() / line0.length();
}
QRectF geom = m_applet->geometry();
QRectF geom = m_applet->geometry();
geom.setWidth(geom.width()*scaleFactor);
geom.setHeight(geom.height()*scaleFactor);
geom.moveCenter(line1.pointAt(0.5));
geom.setHeight(geom.height()*scaleFactor);
geom.moveCenter(line1.pointAt(0.5));
m_applet->setGeometry(geom);
}
return true;