plasma: parent the animations to the widget they belong to in launcher applet

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-17 21:17:06 +03:00
parent 554f6c0b37
commit e44a3283c2

View file

@ -162,7 +162,6 @@ class LauncherWidget : public QGraphicsWidget
Q_OBJECT
public:
LauncherWidget(QGraphicsWidget *parent);
~LauncherWidget();
void setup(const QSizeF &iconsize, const QIcon &icon, const QString &text, const QString &subtext);
void disableHover();
@ -269,26 +268,6 @@ LauncherWidget::LauncherWidget(QGraphicsWidget *parent)
);
}
LauncherWidget::~LauncherWidget()
{
if (m_action1animation) {
m_action1animation->stop();
delete m_action1animation;
}
if (m_action2animation) {
m_action2animation->stop();
delete m_action2animation;
}
if (m_action3animation) {
m_action3animation->stop();
delete m_action3animation;
}
if (m_action4animation) {
m_action4animation->stop();
delete m_action4animation;
}
}
void LauncherWidget::setup(const QSizeF &iconsize, const QIcon &icon, const QString &text, const QString &subtext)
{
m_iconwidget->setMinimumIconSize(iconsize);
@ -424,9 +403,8 @@ void LauncherWidget::animateFadeIn(Plasma::Animation *animation, Plasma::ToolBut
}
if (animation) {
animation->stop();
}
if (!animation) {
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
} else {
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation, this);
Q_ASSERT(animation != nullptr);
animation->setTargetWidget(toolbutton);
}
@ -442,9 +420,8 @@ void LauncherWidget::animateFadeOut(Plasma::Animation *animation, Plasma::ToolBu
}
if (animation) {
animation->stop();
}
if (!animation) {
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation);
} else {
animation = Plasma::Animator::create(Plasma::Animator::FadeAnimation, this);
Q_ASSERT(animation != nullptr);
animation->setTargetWidget(toolbutton);
}