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 <axel.spoerl@qt.io>bb10
parent
af5d0b0f0c
commit
4d9d66d7a8
|
|
@ -1265,12 +1265,6 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
|
|||
#endif // QT_CONFIG(tabbar)
|
||||
|
||||
#if QT_CONFIG(animation)
|
||||
/*! \internal */
|
||||
QList<const QObject*> 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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -92,12 +92,10 @@ public:
|
|||
|
||||
int animationFps;
|
||||
#if QT_CONFIG(animation)
|
||||
void _q_removeAnimation();
|
||||
|
||||
QList<const QObject*> animationTargets() const;
|
||||
QStyleAnimation* animation(const QObject *target) const;
|
||||
void startAnimation(QStyleAnimation *animation) const;
|
||||
void stopAnimation(const QObject *target) const;
|
||||
void removeAnimation();
|
||||
|
||||
private:
|
||||
mutable QHash<const QObject*, QStyleAnimation*> animations;
|
||||
|
|
|
|||
Loading…
Reference in New Issue