diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 64eb76d..ba220c7 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1148,6 +1148,9 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const Q_Q(const QCommonStyle); stopAnimation(animation->target()); q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection); + qDebug() << __FUNCTION__ << animation->target()<< animation; + if (animation->target()->inherits("QTableWidget")) + qDebug() << __FUNCTION__ << "TABLEWIDGET"; animations.insert(animation->target(), animation); animation->start(QAbstractAnimation::DeleteWhenStopped); } @@ -1156,6 +1159,7 @@ void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const void QCommonStylePrivate::stopAnimation(const QObject *target) const { QStyleAnimation *animation = animations.take(target); + qDebug() << __FUNCTION__ << target<< animation; if (animation) { animation->stop(); delete animation; diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index e288b18..d097b1e 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1750,6 +1750,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai p->restore(); //restore state } else { + qDebug( "Stop1"); d->stopAnimation(opt->styleObject); QCommonStyle::drawControl(ce, opt, p, widget); } diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index e9bc17f..c6c2cfe 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -268,6 +268,7 @@ bool QWindowsVistaAnimation::isUpdateNeeded() const void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option) { + qDebug() << __FUNCTION__ << target() << option->rect; painter->drawImage(option->rect, currentImage()); } @@ -308,8 +309,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt int state = option->state; if (!QWindowsVistaStylePrivate::useVista()) { - foreach (const QObject *target, d->animationTargets()) + foreach (const QObject *target, d->animationTargets()) { + qDebug( "Stop2"); d->stopAnimation(target); + } QWindowsStyle::drawPrimitive(element, option, painter, widget); return; } @@ -342,8 +345,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (oldRect != newRect || (state & State_Enabled) != (oldState & State_Enabled) || - (state & State_Active) != (oldState & State_Active)) + (state & State_Active) != (oldState & State_Active)){ + qDebug( "Stop4"); d->stopAnimation(styleObject); + } if (option->state & State_ReadOnly && element == PE_FrameLineEdit) // Do not animate read only line edits doTransition = false; @@ -353,8 +358,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt styleOption->state = (QStyle::State)oldState; QWindowsVistaAnimation *anim = qobject_cast(d->animation(styleObject)); - QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject); + QWindowsVistaTransition *t = new QWindowsVistaTransition(styleObject); +qDebug() << "CREATING " << anim << t<< styleObject; // We create separate images for the initial and final transition states and store them in the // Transition object. QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); @@ -370,8 +376,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt // pulsating default button into the intended target state. if (!anim) proxy()->drawPrimitive(element, styleOption, &startPainter, widget); - else + else { + qDebug() << __FUNCTION__ << "p1"; anim->paint(&startPainter, styleOption); + } t->setStartImage(startImage); @@ -918,6 +926,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (oldRect != newRect || (wasDefault && !isDefault)) { doTransition = false; + qDebug( "Stop5"); d->stopAnimation(styleObject); } @@ -937,7 +946,9 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (!anim) { proxy()->drawControl(element, styleOption, &startPainter, widget); } else { + qDebug() << __FUNCTION__ << "p2"; anim->paint(&startPainter, styleOption); + qDebug( "Stop6"); d->stopAnimation(styleObject); } @@ -967,6 +978,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption } QWindowsVistaAnimation *anim = qobject_cast(d->animation(styleObject)); + qDebug() << __FUNCTION__ << "p3"; if (anim) { anim->paint(painter, option); return; @@ -1029,8 +1041,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption anim = pulse; } - if (anim) + if (anim) { + qDebug() << __FUNCTION__ << "p4"; anim->paint(painter, option); + } else { XPThemeData theme(widget, painter, themeNumber, partId, stateId, rect); d->drawBackground(theme); @@ -1169,8 +1183,10 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (animOffset > animationWidth) { if (bar->progress < bar->maximum) a->setStartTime(QTime::currentTime()); - else + else { + qDebug( "Stop7"); d->stopAnimation(styleObject(option)); //we stop the glow motion only after it has + } //moved out of view } painter->save(); @@ -1550,6 +1566,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle { QWindowsVistaStylePrivate *d = const_cast(d_func()); if (!QWindowsVistaStylePrivate::useVista()) { + qDebug( "Stop8"); foreach (const QObject *target, d->animationTargets()) d->stopAnimation(target); QWindowsStyle::drawComplexControl(control, option, painter, widget); @@ -1593,6 +1610,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle styleObject->setProperty("_q_stylesliderpos", currentPos); if (oldSliderPos != currentPos) { doTransition = false; + qDebug( "Stop9"); d->stopAnimation(styleObject); } } else if (control == CC_SpinBox) { @@ -1630,6 +1648,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle styleOption->activeSubControls = (QStyle::SubControl)oldActiveControls; proxy()->drawComplexControl(control, styleOption, &startPainter, widget); } else { + qDebug() << __FUNCTION__ << "p5"; anim->paint(&startPainter, option); } t->setStartImage(startImage); @@ -1653,6 +1672,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle d->startAnimation(t); } if (QWindowsVistaAnimation *anim = qobject_cast(d->animation(styleObject))) { + qDebug() << __FUNCTION__ << "p6"; anim->paint(painter, option); return; } @@ -2413,7 +2433,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) // theme handle map due to a theme or QStyle change (QProxyStyle). if (!QWindowsXPStylePrivate::hasTheme(QWindowsXPStylePrivate::TreeViewTheme)) d->cleanupTreeViewTheming(); - + qDebug( "Stop10"); d->stopAnimation(widget); #ifndef QT_NO_LINEEDIT diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index 17d510a..32e4f9d 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -139,7 +139,13 @@ class QWindowsVistaAnimation : public QBlendStyleAnimation { Q_OBJECT public: - QWindowsVistaAnimation(Type type, QObject *target) : QBlendStyleAnimation(type, target) { } + QWindowsVistaAnimation(Type type, QObject *target) : QBlendStyleAnimation(type, target) + { + qDebug() << __FUNCTION__ << type << target; + } + ~QWindowsVistaAnimation() { + qDebug() << __FUNCTION__ << target(); + } virtual bool isUpdateNeeded() const; void paint(QPainter *painter, const QStyleOption *option);