From bf9a4ef8b4210bd1f434828911361008ea2350ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Mon, 11 Aug 2014 19:28:23 +0100 Subject: [PATCH] Fix QT_NO_ANIMATION build Change-Id: Ia589e703206d6ca675a392e634e2a445dcf4cca3 Reviewed-by: Marc Mutz --- src/gui/kernel/qguiapplication.cpp | 4 ++++ src/widgets/styles/qcommonstyle.cpp | 2 ++ src/widgets/styles/qcommonstyle.h | 2 ++ src/widgets/styles/qcommonstyle_p.h | 4 ++++ src/widgets/styles/qstyleanimation.cpp | 5 +++++ src/widgets/styles/qstyleanimation_p.h | 4 ++++ src/widgets/widgets/qlineedit_p.cpp | 4 ++++ src/widgets/widgets/qlineedit_p.h | 4 ++++ 8 files changed, 29 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index e5cf48dd6b..7648233608 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -175,7 +175,9 @@ bool QGuiApplicationPrivate::noGrab = false; static qreal fontSmoothingGamma = 1.7; extern void qRegisterGuiVariant(); +#ifndef QT_NO_ANIMATION extern void qRegisterGuiGetInterpolator(); +#endif extern void qInitDrawhelperAsm(); extern void qInitImageConversions(); @@ -1288,8 +1290,10 @@ void QGuiApplicationPrivate::init() // trigger registering of QVariant's GUI types qRegisterGuiVariant(); +#ifndef QT_NO_ANIMATION // trigger registering of animation interpolators qRegisterGuiGetInterpolator(); +#endif QWindowSystemInterfacePrivate::eventTime.start(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index d7030c5d72..27fef46772 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1136,6 +1136,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTabV3 *opt, const QWidget } #endif //QT_NO_TABBAR +#ifndef QT_NO_ANIMATION /*! \internal */ QList QCommonStylePrivate::animationTargets() const { @@ -1176,6 +1177,7 @@ void QCommonStylePrivate::_q_removeAnimation() if (animation) animations.remove(animation->parent()); } +#endif /*! \reimp diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h index 942721a6a3..ef5634a94d 100644 --- a/src/widgets/styles/qcommonstyle.h +++ b/src/widgets/styles/qcommonstyle.h @@ -98,7 +98,9 @@ protected: private: Q_DECLARE_PRIVATE(QCommonStyle) Q_DISABLE_COPY(QCommonStyle) +#ifndef QT_NO_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 8f8a97a2dc..1f5d8b8a81 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -77,7 +77,9 @@ public: ~QCommonStylePrivate() { +#ifndef QT_NO_ANIMATION qDeleteAll(animations); +#endif #ifndef QT_NO_ITEMVIEWS delete cachedOption; #endif @@ -114,6 +116,7 @@ public: #endif int animationFps; +#ifndef QT_NO_ANIMATION void _q_removeAnimation(); QList animationTargets() const; @@ -123,6 +126,7 @@ public: private: mutable QHash animations; +#endif // QT_NO_ANIMATION }; QT_END_NAMESPACE diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 85dc357ab5..6668be8307 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -40,6 +40,9 @@ ****************************************************************************/ #include "qstyleanimation_p.h" + +#ifndef QT_NO_ANIMATION + #include #include #include @@ -344,3 +347,5 @@ void QScrollbarStyleAnimation::updateCurrentTime(int time) } QT_END_NAMESPACE + +#endif //QT_NO_ANIMATION diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index c344858812..33868a3440 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -48,6 +48,8 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_ANIMATION + // // W A R N I N G // ------------- @@ -184,6 +186,8 @@ private: bool _active; }; +#endif // QT_NO_ANIMATION + QT_END_NAMESPACE #endif // QSTYLEANIMATION_P_H diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index d19fe43eb2..a4394ae92b 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -337,6 +337,7 @@ void QLineEditIconButton::setOpacity(qreal value) } } +#ifndef QT_NO_ANIMATION void QLineEditIconButton::startOpacityAnimation(qreal endValue) { QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity")); @@ -344,6 +345,7 @@ void QLineEditIconButton::startOpacityAnimation(qreal endValue) animation->setEndValue(endValue); animation->start(QAbstractAnimation::DeleteWhenStopped); } +#endif void QLineEditIconButton::updateCursor() { @@ -358,6 +360,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) const int newTextSize = text.size(); if (!newTextSize || !lastTextSize) { lastTextSize = newTextSize; +#ifndef QT_NO_ANIMATION const bool fadeIn = newTextSize > 0; foreach (const SideWidgetEntry &e, leadingSideWidgets) { if (e.flags & SideWidgetFadeInWithText) @@ -367,6 +370,7 @@ void QLineEditPrivate::_q_textChanged(const QString &text) if (e.flags & SideWidgetFadeInWithText) static_cast(e.widget)->animateShow(fadeIn); } +#endif } } } diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index db8edee005..7749d9902a 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -84,7 +84,9 @@ public: qreal opacity() const { return m_opacity; } void setOpacity(qreal value); +#ifndef QT_NO_ANIMATION void animateShow(bool visible) { startOpacityAnimation(visible ? 1.0 : 0.0); } +#endif protected: void paintEvent(QPaintEvent *event); @@ -93,7 +95,9 @@ private slots: void updateCursor(); private: +#ifndef QT_NO_ANIMATION void startOpacityAnimation(qreal endValue); +#endif qreal m_opacity; };