tabs--
svn path=/trunk/KDE/kdelibs/; revision=1050130
This commit is contained in:
parent
c80e22969c
commit
644d5e363e
@ -743,29 +743,29 @@ bool AppletHandle::sceneEvent(QEvent *event)
|
|||||||
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
|
const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
|
||||||
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
|
const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
|
||||||
|
|
||||||
//rotation
|
//rotation
|
||||||
QLineF line0(touchPoint0.lastScenePos(), touchPoint1.lastScenePos());
|
QLineF line0(touchPoint0.lastScenePos(), touchPoint1.lastScenePos());
|
||||||
QLineF line1(touchPoint0.scenePos(), touchPoint1.scenePos());
|
QLineF line1(touchPoint0.scenePos(), touchPoint1.scenePos());
|
||||||
//m_applet->setTransformOriginPoint(m_applet->boundingRect().center());
|
//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->setRotation(m_angle);
|
||||||
//m_applet->setTransformOriginPoint(QPointF(0,0));
|
//m_applet->setTransformOriginPoint(QPointF(0,0));
|
||||||
QTransform t = m_applet->transform();
|
QTransform t = m_applet->transform();
|
||||||
t.translate(m_applet->size().width()/2, m_applet->size().height()/2);
|
t.translate(m_applet->size().width()/2, m_applet->size().height()/2);
|
||||||
t.rotate(m_angle);
|
t.rotate(m_angle);
|
||||||
t.translate(-m_applet->size().width()/2, -m_applet->size().height()/2);
|
t.translate(-m_applet->size().width()/2, -m_applet->size().height()/2);
|
||||||
m_applet->setTransform(t);
|
m_applet->setTransform(t);
|
||||||
|
|
||||||
|
|
||||||
//scaling
|
//scaling
|
||||||
qreal scaleFactor = 1;
|
qreal scaleFactor = 1;
|
||||||
if (line0.length() > 0) {
|
if (line0.length() > 0) {
|
||||||
scaleFactor = line1.length() / line0.length();
|
scaleFactor = line1.length() / line0.length();
|
||||||
}
|
}
|
||||||
QRectF geom = m_applet->geometry();
|
QRectF geom = m_applet->geometry();
|
||||||
geom.setWidth(geom.width()*scaleFactor);
|
geom.setWidth(geom.width()*scaleFactor);
|
||||||
geom.setHeight(geom.height()*scaleFactor);
|
geom.setHeight(geom.height()*scaleFactor);
|
||||||
geom.moveCenter(line1.pointAt(0.5));
|
geom.moveCenter(line1.pointAt(0.5));
|
||||||
m_applet->setGeometry(geom);
|
m_applet->setGeometry(geom);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user