From 4d9d66d7a82d7b4960a377220ffa4ca4428c24c3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 20 Oct 2023 09:25:35 +0200 Subject: [PATCH] QCommonStyle: use pmf-style connect Use pmf-style connect in QCommonStyle and remove the unused function animationTargets() as a drive-by Change-Id: I60e361ab00429a95eeab8799743996cea3f1469a Reviewed-by: Axel Spoerl --- src/widgets/styles/qcommonstyle.cpp | 12 ++++-------- src/widgets/styles/qcommonstyle.h | 3 --- src/widgets/styles/qcommonstyle_p.h | 4 +--- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 7345055dee..7916609dd7 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1265,12 +1265,6 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w #endif // QT_CONFIG(tabbar) #if QT_CONFIG(animation) -/*! \internal */ -QList QCommonStylePrivate::animationTargets() const -{ - return animations.keys(); -} - /*! \internal */ QStyleAnimation * QCommonStylePrivate::animation(const QObject *target) const { @@ -1282,7 +1276,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const { Q_Q(const QCommonStyle); stopAnimation(animation->target()); - q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection); + QObjectPrivate::connect(animation, &QStyleAnimation::destroyed, + this, &QCommonStylePrivate::removeAnimation, + Qt::UniqueConnection); animations.insert(animation->target(), animation); animation->start(); } @@ -1298,7 +1294,7 @@ void QCommonStylePrivate::stopAnimation(const QObject *target) const } /*! \internal */ -void QCommonStylePrivate::_q_removeAnimation() +void QCommonStylePrivate::removeAnimation() { Q_Q(QCommonStyle); QObject *animation = q->sender(); diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h index d6485c6015..40ed13d453 100644 --- a/src/widgets/styles/qcommonstyle.h +++ b/src/widgets/styles/qcommonstyle.h @@ -61,9 +61,6 @@ protected: private: Q_DECLARE_PRIVATE(QCommonStyle) Q_DISABLE_COPY(QCommonStyle) -#if QT_CONFIG(animation) - Q_PRIVATE_SLOT(d_func(), void _q_removeAnimation()) -#endif }; QT_END_NAMESPACE diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h index bd35dd4cfc..b9f32230f9 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -92,12 +92,10 @@ public: int animationFps; #if QT_CONFIG(animation) - void _q_removeAnimation(); - - QList animationTargets() const; QStyleAnimation* animation(const QObject *target) const; void startAnimation(QStyleAnimation *animation) const; void stopAnimation(const QObject *target) const; + void removeAnimation(); private: mutable QHash animations;