minor code claryfication

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=830656
This commit is contained in:
Loic Marteau 2008-07-10 22:11:18 +00:00
parent f81134ff97
commit 17e88ccf66

View File

@ -836,7 +836,6 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos)
m_animId = Animator::self()->customAnimation(40, (int)time, Animator::EaseInOutCurve, this, "fadeAnimation"); m_animId = Animator::self()->customAnimation(40, (int)time, Animator::EaseInOutCurve, this, "fadeAnimation");
} }
void AppletHandle::forceDisappear() void AppletHandle::forceDisappear()
{ {
setAcceptsHoverEvents(false); setAcceptsHoverEvents(false);
@ -858,21 +857,22 @@ int AppletHandle::minimumHeight()
void AppletHandle::calculateSize() void AppletHandle::calculateSize()
{ {
int requiredHeight = minimumHeight(); int handleHeight = minimumHeight();
int top = m_applet->contentsRect().top(); int top = m_applet->contentsRect().top();
if (requiredHeight > m_applet->contentsRect().height()) { if (handleHeight > m_applet->contentsRect().height()) {
top += (m_applet->contentsRect().height() - requiredHeight) / 2.0; //center the handle if it is higher than the applet
top += (m_applet->contentsRect().height() - handleHeight) / 2.0;
} else { } else {
requiredHeight = m_applet->contentsRect().height(); handleHeight = m_applet->contentsRect().height();
} }
if (m_buttonsOnRight) { if (m_buttonsOnRight) {
//put the rect on the right of the applet //put the rect on the right of the applet
m_rect = QRectF(m_applet->size().width(), top, HANDLE_WIDTH, requiredHeight); m_rect = QRectF(m_applet->size().width(), top, HANDLE_WIDTH, handleHeight);
} else { } else {
//put the rect on the left of the applet //put the rect on the left of the applet
m_rect = QRectF(-HANDLE_WIDTH, top, HANDLE_WIDTH, requiredHeight); m_rect = QRectF(-HANDLE_WIDTH, top, HANDLE_WIDTH, handleHeight);
} }
m_rect = m_applet->mapToParent(m_rect).boundingRect(); m_rect = m_applet->mapToParent(m_rect).boundingRect();