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
This commit is contained in:
Marco Martin 2016-02-17 17:16:02 +01:00
parent 3224f87c15
commit ce9751cb35
3 changed files with 0 additions and 62 deletions

View File

@ -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());

View File

@ -22,7 +22,6 @@
#include <QQmlEngine>
#include <QQuickItem>
#include <QDebug>
#include <QPropertyAnimation>
#include <kdeclarative/qmlobjectsharedengine.h>
@ -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;

View File

@ -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;
};