From 65455b418b17eba37040dae59a8fe47900e6b4b6 Mon Sep 17 00:00:00 2001 From: Bruno Bigras Date: Thu, 3 Dec 2009 06:13:38 +0000 Subject: [PATCH] Revert "Fix a bug when a plasmoid could be resized to a smaller value than it's minimumSize" Fix _k_rotatePoint so it returns 0,0 when rotating a 0,0 point svn path=/trunk/KDE/kdelibs/; revision=1057684 --- private/applethandle.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/private/applethandle.cpp b/private/applethandle.cpp index 2bb72dbbc..69bf983d7 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -571,6 +571,12 @@ qreal _k_pointAngle(QPointF in) QPointF _k_rotatePoint(QPointF in, qreal rotateAngle) { + // if the point is 0, 0 it should always be the same even if rotated + // without this the function would return a NaN + if (in == QPointF(0, 0)) { + return in; + } + qreal r = sqrt(in.x()*in.x() + in.y()*in.y()); qreal cosine = in.x()/r; qreal sine = in.y()/r; @@ -711,17 +717,10 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event) if (m_pressedButton == ResizeButton) { // set applet size //kDebug() << newCenter << m_originalGeom.topLeft() << newSize; - - // Prevent the plasmoid from resizing itself to a smaller value than the minimumsize - if (newSize.x() > m_applet->minimumSize().width() && - newSize.y() > m_applet->minimumSize().height() && - newSize.x() > m_applet->effectiveSizeHint(Qt::MinimumSize).width() && - newSize.y() > m_applet->effectiveSizeHint(Qt::MinimumSize).height()) { - QPointF newPos = m_originalGeom.topLeft() + _k_rotatePoint(newCenter, m_angle); - m_applet->setPos(newPos); - // m_applet->moveBy(newCenter.x(), newCenter.y()); - m_applet->resize(newSize.x(), newSize.y()); - } + QPointF newPos = m_originalGeom.topLeft() + _k_rotatePoint(newCenter, m_angle); + m_applet->setPos(newPos); + // m_applet->moveBy(newCenter.x(), newCenter.y()); + m_applet->resize(newSize.x(), newSize.y()); } else { // set applet handle rotation - rotate around center of applet QRectF appletGeomLocal = m_originalGeom;