[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdelibs/plasma/private
From: Ambroz Bizjak <ambrop7 () gmail ! com>
Date: 2009-02-20 23:24:51
Message-ID: 1235172291.205577.20484.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 929237 by abizjak:
backport revision 929233
Fix handle possibly moving to the other side if the cursor exist for a short time.
Remove the handle if the cursor goes away before we even appear, previously the handle
was kept invisible until the cursor next entered.
M +19 -21 applethandle.cpp
M +2 -2 applethandle_p.h
--- branches/KDE/4.2/kdelibs/plasma/private/applethandle.cpp #929236:929237
@@ -102,7 +102,7 @@
m_leaveTimer->setSingleShot(true);
m_leaveTimer->setInterval(500);
- connect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(fadeIn()));
+ connect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(hoverTimeout()));
connect(m_leaveTimer, SIGNAL(timeout()), this, SLOT(leaveTimeout()));
connect(m_applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed()));
@@ -145,7 +145,7 @@
return;
}
- disconnect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(fadeIn()));
+ disconnect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(hoverTimeout()));
disconnect(m_leaveTimer, SIGNAL(timeout()), this, SLOT(leaveTimeout()));
m_applet->disconnect(this);
@@ -771,29 +771,29 @@
//kDebug() << "hover enter";
//if a disappear was scheduled stop the timer
- m_leaveTimer->stop();
-
+ if (m_leaveTimer->isActive()) {
+ m_leaveTimer->stop();
+ }
// if we're already fading out, fade back in
- if (m_animId != 0 && m_anim == FadeOut) {
- startFading(FadeIn, m_entryPos);
- } else {
- //schedule appear
- m_hoverTimer->start();
+ else if (m_animId != 0 && m_anim == FadeOut) {
+ startFading(FadeIn, m_entryPos, true);
}
}
void AppletHandle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
{
- Q_UNUSED(event);
- m_leaveTimer->stop();
+ hoverEnterEvent(event);
}
void AppletHandle::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
- m_hoverTimer->stop();
- if (m_pressedButton != NoButton) {
+ // if we haven't even showed up yet, remove the handle
+ if (m_hoverTimer->isActive()) {
+ m_hoverTimer->stop();
+ QTimer::singleShot(0, this, SLOT(emitDisappear()));
+ } else if (m_pressedButton != NoButton) {
m_pendingFade = true;
} else {
//wait a moment to hide the handle in order to recheck the mouse position
@@ -829,7 +829,7 @@
update();
}
-void AppletHandle::fadeIn()
+void AppletHandle::hoverTimeout()
{
startFading(FadeIn, m_entryPos);
}
@@ -856,20 +856,16 @@
m_entryPos = hoverPos;
}
-void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos)
+void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos, bool preserveSide)
{
if (m_animId != 0) {
Animator::self()->stopCustomAnimation(m_animId);
}
- m_hoverTimer->stop();
- m_leaveTimer->stop();
-
m_entryPos = hoverPos;
qreal time = 100;
- if (!m_applet || (anim == FadeOut && m_hoverTimer->isActive())) {
- // fading out before we've started fading in
+ if (!m_applet) {
m_anim = FadeOut;
fadeAnimation(1.0);
return;
@@ -879,7 +875,9 @@
//kDebug() << m_entryPos.x() << m_applet->pos().x();
prepareGeometryChange();
bool wasOnRight = m_buttonsOnRight;
- m_buttonsOnRight = m_entryPos.x() > (m_applet->size().width() / 2);
+ if (!preserveSide) {
+ m_buttonsOnRight = m_entryPos.x() > (m_applet->size().width() / 2);
+ }
calculateSize();
QPolygonF region = mapToParent(m_rect).intersected(parentWidget()->boundingRect());
//kDebug() << region << m_rect << mapToParent(m_rect) << parentWidget()->boundingRect();
--- branches/KDE/4.2/kdelibs/plasma/private/applethandle_p.h #929236:929237
@@ -63,7 +63,7 @@
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
- void startFading(FadeType anim, const QPointF &hoverPos);
+ void startFading(FadeType anim, const QPointF &hoverPos, bool preserveSide = false);
void setHoverPos(const QPointF &hoverPos);
protected:
@@ -83,7 +83,7 @@
void fadeAnimation(qreal progress);
void appletDestroyed();
void appletResized();
- void fadeIn();
+ void hoverTimeout();
void leaveTimeout();
void emitDisappear();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic