From ce9751cb35d654a580736146e2d16a617fd49bd0 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 17 Feb 2016 17:16:02 +0100 Subject: [PATCH] drop animations from tooltips tooltips are now animated by a KWin effect, don't try to animate own X11 positions, that's quite dangerous Change-Id: I08ef2bc23ec1ef7cb7c432ba1bf6d9c5b0a0ab01 --- src/declarativeimports/core/tooltip.cpp | 2 - src/declarativeimports/core/tooltipdialog.cpp | 49 ------------------- src/declarativeimports/core/tooltipdialog.h | 11 ----- 3 files changed, 62 deletions(-) diff --git a/src/declarativeimports/core/tooltip.cpp b/src/declarativeimports/core/tooltip.cpp index a5e223b8b..a04f50737 100644 --- a/src/declarativeimports/core/tooltip.cpp +++ b/src/declarativeimports/core/tooltip.cpp @@ -155,8 +155,6 @@ void ToolTip::showToolTip() dlg->setOwner(this); - //if the dialog is not currently visible, disable the animated repositioning - dlg->setAnimationsEnabled(dlg->isVisible()); dlg->show(); dlg->setLocation(location); dlg->setMainItem(mainItem()); diff --git a/src/declarativeimports/core/tooltipdialog.cpp b/src/declarativeimports/core/tooltipdialog.cpp index 6c3712e29..da58df076 100644 --- a/src/declarativeimports/core/tooltipdialog.cpp +++ b/src/declarativeimports/core/tooltipdialog.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -34,10 +33,8 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent) : Dialog(parent), m_qmlObject(0), - m_animation(0), m_hideTimeout(4000), m_interactive(false), - m_animationsEnabled(true), m_owner(Q_NULLPTR) { Qt::WindowFlags flags = Qt::ToolTip; @@ -49,13 +46,6 @@ ToolTipDialog::ToolTipDialog(QQuickItem *parent) setFlags(flags); setLocation(Plasma::Types::Floating); - m_animation = new QPropertyAnimation(this); - connect(m_animation, SIGNAL(valueChanged(QVariant)), - this, SLOT(valueChanged(QVariant))); - m_animation->setTargetObject(this); - m_animation->setEasingCurve(QEasingCurve::InOutQuad); - m_animation->setDuration(250); - m_showTimer = new QTimer(this); m_showTimer->setSingleShot(true); connect(m_showTimer, &QTimer::timeout, [ = ]() { @@ -89,7 +79,6 @@ QQuickItem *ToolTipDialog::loadDefaultItem() void ToolTipDialog::showEvent(QShowEvent *event) { m_showTimer->start(m_hideTimeout); - m_animation->stop(); Dialog::showEvent(event); } @@ -97,7 +86,6 @@ void ToolTipDialog::showEvent(QShowEvent *event) void ToolTipDialog::hideEvent(QHideEvent *event) { m_showTimer->stop(); - m_animation->stop(); Dialog::hideEvent(event); } @@ -128,43 +116,6 @@ bool ToolTipDialog::event(QEvent *e) return ret; } -void ToolTipDialog::adjustGeometry(const QRect &geom) -{ - if (m_animationsEnabled) { - QRect startGeom(geometry()); - - switch (location()) { - case Plasma::Types::RightEdge: - startGeom.moveLeft(geom.left()); - break; - case Plasma::Types::BottomEdge: - startGeom.moveTop(geom.top()); - break; - default: - break; - } - - startGeom.setSize(geom.size()); - setGeometry(startGeom); - - m_animation->setStartValue(startGeom.topLeft()); - m_animation->setEndValue(geom.topLeft()); - m_animation->start(); - } else { - setGeometry(geom); - } -} - -bool ToolTipDialog::animationsEnabled() const -{ - return m_animationsEnabled; -} - -void ToolTipDialog::setAnimationsEnabled(bool enabled) -{ - m_animationsEnabled = enabled; -} - QObject *ToolTipDialog::owner() const { return m_owner; diff --git a/src/declarativeimports/core/tooltipdialog.h b/src/declarativeimports/core/tooltipdialog.h index 2ea8af9cb..d4e0ff0a6 100644 --- a/src/declarativeimports/core/tooltipdialog.h +++ b/src/declarativeimports/core/tooltipdialog.h @@ -29,7 +29,6 @@ class QQuickItem; class QGraphicsWidget; -class QPropertyAnimation; namespace KDeclarative { @@ -52,20 +51,12 @@ public: Plasma::Types::Direction direction() const; void setDirection(Plasma::Types::Direction loc); - /** - * animate the position change if visible - */ - void adjustGeometry(const QRect &geom) Q_DECL_OVERRIDE; - void dismiss(); void keepalive(); bool interactive(); void setInteractive(bool interactive); - bool animationsEnabled() const; - void setAnimationsEnabled(bool enabled); - /** * Basically the last one who has shown the dialog */ @@ -84,10 +75,8 @@ private Q_SLOTS: private: KDeclarative::QmlObject *m_qmlObject; QTimer *m_showTimer; - QPropertyAnimation *m_animation; int m_hideTimeout; bool m_interactive; - bool m_animationsEnabled; QObject *m_owner; };