summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-09-26 15:39:35 +0200
committerLiang Qi <liang.qi@qt.io>2018-10-12 14:26:15 +0000
commitc593492d1678a2ec08f1bfffcb572459b3bc6c00 (patch)
treea9427b13e0f3aa252d68decc862de5acb4dc3b17 /src
parent0509383cf2852f2aebd1efd75413835747c8f341 (diff)
Modernize the "animation" feature
Change-Id: Ibc164b3df3cf87db569ef4813de458a9067b7f7d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp4
-rw-r--r--src/corelib/animation/qabstractanimation.h10
-rw-r--r--src/corelib/animation/qabstractanimation_p.h4
-rw-r--r--src/corelib/animation/qanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qanimationgroup.h7
-rw-r--r--src/corelib/animation/qanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h7
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qpauseanimation.cpp5
-rw-r--r--src/corelib/animation/qpauseanimation.h7
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp4
-rw-r--r--src/corelib/animation/qpropertyanimation.h7
-rw-r--r--src/corelib/animation/qpropertyanimation_p.h4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h7
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qvariantanimation.cpp4
-rw-r--r--src/corelib/animation/qvariantanimation.h7
-rw-r--r--src/corelib/animation/qvariantanimation_p.h4
-rw-r--r--src/corelib/corelib.pro2
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp2
-rw-r--r--src/corelib/statemachine/qabstracttransition.h4
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h2
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp30
-rw-r--r--src/corelib/statemachine/qstatemachine.h8
-rw-r--r--src/corelib/statemachine/qstatemachine_p.h2
-rw-r--r--src/gui/animation/qguivariantanimation.cpp4
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/widgets/configure.json4
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp16
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h4
-rw-r--r--src/widgets/itemviews/qtreeview.cpp28
-rw-r--r--src/widgets/itemviews/qtreeview.h4
-rw-r--r--src/widgets/itemviews/qtreeview_p.h6
-rw-r--r--src/widgets/styles/qcommonstyle.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.h2
-rw-r--r--src/widgets/styles/qcommonstyle_p.h9
-rw-r--r--src/widgets/styles/qfusionstyle.cpp12
-rw-r--r--src/widgets/styles/qstyleanimation.cpp4
-rw-r--r--src/widgets/styles/qstyleanimation_p.h6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp2
-rw-r--r--src/widgets/styles/styles.pri7
-rw-r--r--src/widgets/util/qscroller.cpp18
-rw-r--r--src/widgets/util/qscroller_p.h6
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp4
-rw-r--r--src/widgets/widgets/qlineedit_p.h4
-rw-r--r--src/widgets/widgets/qtabbar.cpp6
-rw-r--r--src/widgets/widgets/qtabbar_p.h10
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp18
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h2
53 files changed, 145 insertions, 198 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index b3db200ed1..4d7ce038dd 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -153,8 +153,6 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qpointer.h>
-#ifndef QT_NO_ANIMATION
-
#define DEFAULT_TIMER_INTERVAL 16
#define PAUSE_TIMER_COARSE_THRESHOLD 2000
@@ -1485,5 +1483,3 @@ QT_END_NAMESPACE
#include "moc_qabstractanimation.cpp"
#include "moc_qabstractanimation_p.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index 0ff6bc5176..25b5726d56 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -42,10 +42,9 @@
#include <QtCore/qobject.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QAnimationGroup;
class QSequentialAnimationGroup;
@@ -169,11 +168,6 @@ private:
};
-
-
-
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif // QABSTRACTANIMATION_H
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 5593046e48..3b6e8d6cc4 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -58,7 +58,7 @@
#include <private/qobject_p.h>
#include <qabstractanimation.h>
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -296,6 +296,4 @@ private:
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QABSTRACTANIMATION_P_H
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index 486dc149ea..f47d99eb68 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -86,8 +86,6 @@
#include <QtCore/qcoreevent.h>
#include "qanimationgroup_p.h"
-#ifndef QT_NO_ANIMATION
-
#include <algorithm>
QT_BEGIN_NAMESPACE
@@ -300,5 +298,3 @@ void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *)
QT_END_NAMESPACE
#include "moc_qanimationgroup.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h
index 136ad3ca9f..7c7666f251 100644
--- a/src/corelib/animation/qanimationgroup.h
+++ b/src/corelib/animation/qanimationgroup.h
@@ -42,10 +42,9 @@
#include <QtCore/qabstractanimation.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QAnimationGroupPrivate;
class Q_CORE_EXPORT QAnimationGroup : public QAbstractAnimation
@@ -74,8 +73,6 @@ private:
Q_DECLARE_PRIVATE(QAnimationGroup)
};
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif //QANIMATIONGROUP_H
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 31c2cd08e8..ff759d11fd 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -57,7 +57,7 @@
#include "private/qabstractanimation_p.h"
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -89,6 +89,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index e4dfc1bd6e..1dcf006dd3 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -72,8 +72,6 @@
#include "qparallelanimationgroup_p.h"
//#define QANIMATION_DEBUG
-#ifndef QT_NO_ANIMATION
-
QT_BEGIN_NAMESPACE
typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt;
@@ -339,5 +337,3 @@ bool QParallelAnimationGroup::event(QEvent *event)
QT_END_NAMESPACE
#include "moc_qparallelanimationgroup.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index 09a439ef24..683d933861 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -42,10 +42,9 @@
#include <QtCore/qanimationgroup.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QParallelAnimationGroupPrivate;
class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup
@@ -72,8 +71,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished())
};
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif // QPARALLELANIMATIONGROUP
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 1c9c3072f7..fc8f809d5a 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -55,7 +55,7 @@
#include "private/qanimationgroup_p.h"
#include <QtCore/qhash.h>
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -86,6 +86,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QPARALLELANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index 654ba701da..5f8a8b3590 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -64,9 +64,6 @@
#include "qpauseanimation.h"
#include "qabstractanimation_p.h"
-
-#ifndef QT_NO_ANIMATION
-
QT_BEGIN_NAMESPACE
class QPauseAnimationPrivate : public QAbstractAnimationPrivate
@@ -150,5 +147,3 @@ void QPauseAnimation::updateCurrentTime(int)
QT_END_NAMESPACE
#include "moc_qpauseanimation.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index e2095a39d6..6bdbeefdbd 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -42,10 +42,9 @@
#include <QtCore/qanimationgroup.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QPauseAnimationPrivate;
@@ -70,8 +69,6 @@ private:
Q_DECLARE_PRIVATE(QPauseAnimation)
};
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif // QPAUSEANIMATION_H
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 5ba2a1fa73..174121516b 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -93,8 +93,6 @@
#include <QtCore/QMutex>
-#ifndef QT_NO_ANIMATION
-
QT_BEGIN_NAMESPACE
void QPropertyAnimationPrivate::updateMetaProperty()
@@ -315,5 +313,3 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
#include "moc_qpropertyanimation.cpp"
QT_END_NAMESPACE
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h
index 3270591d1d..a1caafcad5 100644
--- a/src/corelib/animation/qpropertyanimation.h
+++ b/src/corelib/animation/qpropertyanimation.h
@@ -42,10 +42,9 @@
#include <QtCore/qvariantanimation.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QPropertyAnimationPrivate;
class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation
@@ -75,8 +74,6 @@ private:
Q_DECLARE_PRIVATE(QPropertyAnimation)
};
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif // QPROPERTYANIMATION_H
diff --git a/src/corelib/animation/qpropertyanimation_p.h b/src/corelib/animation/qpropertyanimation_p.h
index cfb1f247e0..479762f573 100644
--- a/src/corelib/animation/qpropertyanimation_p.h
+++ b/src/corelib/animation/qpropertyanimation_p.h
@@ -55,7 +55,7 @@
#include "private/qvariantanimation_p.h"
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -83,6 +83,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QPROPERTYANIMATION_P_H
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index f5f538337e..8af6b33722 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -83,8 +83,6 @@
#include <QtCore/qdebug.h>
-#ifndef QT_NO_ANIMATION
-
QT_BEGIN_NAMESPACE
typedef QList<QAbstractAnimation *>::ConstIterator AnimationListConstIt;
@@ -582,5 +580,3 @@ void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnim
QT_END_NAMESPACE
#include "moc_qsequentialanimationgroup.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index 1c8e67d256..a33ff07abf 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -42,10 +42,9 @@
#include <QtCore/qanimationgroup.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QPauseAnimation;
class QSequentialAnimationGroupPrivate;
@@ -82,8 +81,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_uncontrolledAnimationFinished())
};
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif //QSEQUENTIALANIMATIONGROUP_H
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index e4f3d9c96a..88dac4f566 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -54,7 +54,7 @@
#include "qsequentialanimationgroup.h"
#include "private/qanimationgroup_p.h"
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -107,6 +107,4 @@ public:
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QSEQUENTIALANIMATIONGROUP_P_H
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index 3c90d71c7d..df533c5f4d 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -46,8 +46,6 @@
#include <algorithm>
-#ifndef QT_NO_ANIMATION
-
QT_BEGIN_NAMESPACE
/*!
@@ -700,5 +698,3 @@ void QVariantAnimation::updateCurrentTime(int)
QT_END_NAMESPACE
#include "moc_qvariantanimation.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index d6346e1706..e47fa14b1c 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -46,10 +46,9 @@
#include <QtCore/qvariant.h>
#include <QtCore/qpair.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
class QVariantAnimationPrivate;
class Q_CORE_EXPORT QVariantAnimation : public QAbstractAnimation
@@ -116,8 +115,6 @@ void qRegisterAnimationInterpolator(QVariant (*func)(const T &from, const T &to,
QVariantAnimation::registerInterpolator(reinterpret_cast<QVariantAnimation::Interpolator>(reinterpret_cast<void(*)()>(func)), qMetaTypeId<T>());
}
-#endif //QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif //QVARIANTANIMATION_H
diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h
index 9f0f2e3030..57b59cf876 100644
--- a/src/corelib/animation/qvariantanimation_p.h
+++ b/src/corelib/animation/qvariantanimation_p.h
@@ -60,7 +60,7 @@
#include <type_traits>
-#ifndef QT_NO_ANIMATION
+QT_REQUIRE_CONFIG(animation);
QT_BEGIN_NAMESPACE
@@ -129,6 +129,4 @@ template<typename T > inline QVariant _q_interpolateVariant(const T &from, const
QT_END_NAMESPACE
-#endif //QT_NO_ANIMATION
-
#endif //QVARIANTANIMATION_P_H
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 7f62a6f1b0..1e4823f566 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -31,7 +31,7 @@ ANDROID_PERMISSIONS = \
# OpenBSD 6.0 will include environ in libc.
freebsd|openbsd: QMAKE_LFLAGS_NOUNDEF =
-include(animation/animation.pri)
+qtConfig(animation): include(animation/animation.pri)
include(global/global.pri)
include(thread/thread.pri)
include(tools/tools.pri)
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 272e681fb4..ebf33e120a 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -334,7 +334,7 @@ QStateMachine *QAbstractTransition::machine() const
return d->machine();
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
/*!
Adds the given \a animation to this transition.
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index 9b35e0cdb6..18e12d3eb6 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -53,7 +53,7 @@ class QAbstractState;
class QState;
class QStateMachine;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
class QAbstractAnimation;
#endif
@@ -86,7 +86,7 @@ public:
QStateMachine *machine() const;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void addAnimation(QAbstractAnimation *animation);
void removeAnimation(QAbstractAnimation *animation);
QList<QAbstractAnimation*> animations() const;
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index e11514670e..663d777c75 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -85,7 +85,7 @@ public:
QVector<QPointer<QAbstractState> > targetStates;
QAbstractTransition::TransitionType transitionType;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QList<QAbstractAnimation*> animations;
#endif
};
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 24734f99ac..7388d496d9 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -59,7 +59,7 @@
#include "qeventtransition_p.h"
#endif
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
#include "qpropertyanimation.h"
#include "qanimationgroup.h"
#include <private/qvariantanimation_p.h>
@@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE
\sa start(), stop(), started(), stopped(), runningChanged()
*/
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
/*!
\property QStateMachine::animated
@@ -401,7 +401,7 @@ QStateMachinePrivate::QStateMachinePrivate()
error = QStateMachine::NoError;
globalRestorePolicy = QState::DontRestoreProperties;
signalEventGenerator = 0;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
animated = true;
#endif
}
@@ -700,12 +700,12 @@ void QStateMachinePrivate::microstep(QEvent *event, const QList<QAbstractTransit
executeTransitionContent(event, enabledTransitions);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QList<QAbstractAnimation *> selectedAnimations = selectAnimations(enabledTransitions);
#endif
enterStates(event, exitedStates, enteredStates, statesForDefaultEntry, assignmentsForEnteredStates
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
, selectedAnimations
#endif
);
@@ -827,7 +827,7 @@ void QStateMachinePrivate::exitStates(QEvent *event, const QList<QAbstractState*
#endif
QAbstractStatePrivate::get(s)->callOnExit(event);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
terminateActiveAnimations(s, assignmentsForEnteredStates);
#else
Q_UNUSED(assignmentsForEnteredStates);
@@ -942,7 +942,7 @@ void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState
const QList<QAbstractState*> &statesToEnter_sorted,
const QSet<QAbstractState*> &statesForDefaultEntry,
QHash<QAbstractState*, QVector<QPropertyAssignment> > &propertyAssignmentsForState
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
, const QList<QAbstractAnimation *> &selectedAnimations
#endif
)
@@ -958,7 +958,7 @@ void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState
configuration.insert(s);
registerTransitions(s);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
initializeAnimations(s, selectedAnimations, exitedStates_sorted, propertyAssignmentsForState);
#endif
@@ -1002,7 +1002,7 @@ void QStateMachinePrivate::enterStates(QEvent *event, const QList<QAbstractState
{
QState *ss = toStandardState(s);
if (ss
- #ifndef QT_NO_ANIMATION
+ #if QT_CONFIG(animation)
&& !animationsForState.contains(s)
#endif
)
@@ -1513,7 +1513,7 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta
}
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QStateMachinePrivate::InitializeAnimationResult
QStateMachinePrivate::initializeAnimation(QAbstractAnimation *abstractAnimation,
@@ -1710,7 +1710,7 @@ void QStateMachinePrivate::initializeAnimations(QAbstractState *state, const QLi
}
}
-#endif // !QT_NO_ANIMATION
+#endif // animation
QAbstractTransition *QStateMachinePrivate::createInitialTransition() const
{
@@ -1814,7 +1814,7 @@ void QStateMachinePrivate::_q_start()
QHash<RestorableId, QVariant> pendingRestorables;
QHash<QAbstractState*, QVector<QPropertyAssignment> > assignmentsForEnteredStates =
computePropertyAssignments(enteredStates, pendingRestorables);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QList<QAbstractAnimation*> selectedAnimations = selectAnimations(transitions);
#endif
// enterStates() will set stopProcessingReason to Finished if a final
@@ -1822,7 +1822,7 @@ void QStateMachinePrivate::_q_start()
stopProcessingReason = EventQueueEmpty;
enterStates(&nullEvent, exitedStates, enteredStates, statesForDefaultEntry,
assignmentsForEnteredStates
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
, selectedAnimations
#endif
);
@@ -2957,7 +2957,7 @@ void QStateMachine::onExit(QEvent *event)
QState::onExit(event);
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
/*!
Returns whether animations are enabled for this state machine.
@@ -3004,7 +3004,7 @@ void QStateMachine::removeDefaultAnimation(QAbstractAnimation *animation)
d->defaultAnimations.removeAll(animation);
}
-#endif // QT_NO_ANIMATION
+#endif // animation
// Begin moc-generated code -- modify carefully (check "HAND EDIT" parts)!
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index fd90b86fd5..e520285437 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -60,7 +60,7 @@ class Q_CORE_EXPORT QStateMachine : public QState
Q_PROPERTY(QString errorString READ errorString)
Q_PROPERTY(QState::RestorePolicy globalRestorePolicy READ globalRestorePolicy WRITE setGlobalRestorePolicy)
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
Q_PROPERTY(bool animated READ isAnimated WRITE setAnimated)
#endif
public:
@@ -122,14 +122,14 @@ public:
bool isRunning() const;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
bool isAnimated() const;
void setAnimated(bool enabled);
void addDefaultAnimation(QAbstractAnimation *animation);
QList<QAbstractAnimation *> defaultAnimations() const;
void removeDefaultAnimation(QAbstractAnimation *animation);
-#endif // QT_NO_ANIMATION
+#endif // animation
QState::RestorePolicy globalRestorePolicy() const;
void setGlobalRestorePolicy(QState::RestorePolicy restorePolicy);
@@ -175,7 +175,7 @@ private:
Q_DECLARE_PRIVATE(QStateMachine)
Q_PRIVATE_SLOT(d_func(), void _q_start())
Q_PRIVATE_SLOT(d_func(), void _q_process())
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
Q_PRIVATE_SLOT(d_func(), void _q_animationFinished())
#endif
Q_PRIVATE_SLOT(d_func(), void _q_startDelayedEventTimer(int, int))
diff --git a/src/corelib/statemachine/qstatemachine_p.h b/src/corelib/statemachine/qstatemachine_p.h
index c28b162305..f3366ca5f7 100644
--- a/src/corelib/statemachine/qstatemachine_p.h
+++ b/src/corelib/statemachine/qstatemachine_p.h
@@ -297,7 +297,7 @@ public:
void initializeAnimations(QAbstractState *state, const QList<QAbstractAnimation*> &selectedAnimations,
const QList<QAbstractState *> &exitedStates_sorted,
QHash<QAbstractState *, QVector<QPropertyAssignment> > &assignmentsForEnteredStates);
-#endif // QT_NO_ANIMATION
+#endif // animation
QSignalEventGenerator *signalEventGenerator;
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index b72764e048..a5b6d8b95c 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -38,8 +38,6 @@
****************************************************************************/
#include <QtGui/qtguiglobal.h>
-#ifndef QT_NO_ANIMATION
-
#include <QtCore/qvariantanimation.h>
#include <private/qvariantanimation_p.h>
#include <QtGui/qcolor.h>
@@ -90,5 +88,3 @@ static void qUnregisterGuiGetInterpolator()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator)
QT_END_NAMESPACE
-
-#endif //QT_NO_ANIMATION
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 759d6f3cbf..06c9cd3939 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -45,7 +45,7 @@ include(painting/painting.pri)
include(util/util.pri)
include(math3d/math3d.pri)
include(opengl/opengl.pri)
-include(animation/animation.pri)
+qtConfig(animation): include(animation/animation.pri)
include(itemmodels/itemmodels.pri)
include(vulkan/vulkan.pri)
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index e81c88cc71..193712a7a7 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -204,7 +204,7 @@ QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
static qreal fontSmoothingGamma = 1.7;
extern void qRegisterGuiVariant();
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
extern void qRegisterGuiGetInterpolator();
#endif
@@ -1517,7 +1517,7 @@ void QGuiApplicationPrivate::init()
// trigger registering of QVariant's GUI types
qRegisterGuiVariant();
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
// trigger registering of animation interpolators
qRegisterGuiGetInterpolator();
#endif
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index b3a5227d26..cc9019dfdd 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -47,7 +47,7 @@
},
"style-mac": {
"label": "macOS",
- "condition": "config.osx",
+ "condition": "config.osx && features.animation",
"output": [ "privateFeature", "styles" ]
},
"style-windows": {
@@ -56,7 +56,7 @@
},
"style-windowsvista": {
"label": "WindowsVista",
- "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme",
+ "condition": "features.style-windows && features.animation && config.win32 && !config.winrt && tests.uxtheme",
"output": [ "privateFeature", "styles" ]
},
"style-android": {
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 5100d2a427..1fe17721ba 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -103,12 +103,12 @@ void QColumnViewPrivate::initialize()
{
Q_Q(QColumnView);
q->setTextElideMode(Qt::ElideMiddle);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QObject::connect(&currentAnimation, SIGNAL(finished()), q, SLOT(_q_changeCurrentColumn()));
currentAnimation.setTargetObject(hbar);
currentAnimation.setPropertyName("value");
currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
-#endif //QT_NO_ANIMATION
+#endif // animation
delete itemDelegate;
q->setItemDelegate(new QColumnViewDelegate(q));
}
@@ -258,12 +258,12 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (!index.isValid() || d->columns.isEmpty())
return;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (d->currentAnimation.state() == QPropertyAnimation::Running)
return;
d->currentAnimation.stop();
-#endif //QT_NO_ANIMATION
+#endif // animation
// Fill up what is needed to get to index
d->closeColumns(index, true);
@@ -326,13 +326,13 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
}
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (const int animationDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, this)) {
d->currentAnimation.setDuration(animationDuration);
d->currentAnimation.setEndValue(newScrollbarValue);
d->currentAnimation.start();
} else
-#endif //QT_NO_ANIMATION
+#endif // animation
{
horizontalScrollBar()->setValue(newScrollbarValue);
}
@@ -402,10 +402,10 @@ void QColumnView::resizeEvent(QResizeEvent *event)
void QColumnViewPrivate::updateScrollbars()
{
Q_Q(QColumnView);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (currentAnimation.state() == QPropertyAnimation::Running)
return;
-#endif //QT_NO_ANIMATION
+#endif // animation
// find the total horizontal length of the laid out columns
int horizontalLength = 0;
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index 850ab02747..9f0d2a40dc 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -57,7 +57,9 @@
#include <private/qabstractitemview_p.h>
#include <QtCore/qabstractitemmodel.h>
+#if QT_CONFIG(animation)
#include <QtCore/qpropertyanimation.h>
+#endif
#include <QtWidgets/qabstractitemdelegate.h>
#include <QtWidgets/qabstractitemview.h>
#include <QtWidgets/qitemdelegate.h>
@@ -169,7 +171,7 @@ public:
QVector<int> columnSizes; // used during init and corner moving
bool showResizeGrips;
int offset;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QPropertyAnimation currentAnimation;
#endif
QWidget *previewWidget;
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index fbfbe56246..7f99a2c6cb 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1334,12 +1334,12 @@ void QTreeView::paintEvent(QPaintEvent *event)
Q_D(QTreeView);
d->executePostedLayout();
QPainter painter(viewport());
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (d->isAnimating()) {
drawTree(&painter, event->region() - d->animatedOperation.rect());
d->drawAnimatedOperation(&painter);
} else
-#endif //QT_NO_ANIMATION
+#endif // animation
{
drawTree(&painter, event->region());
#if QT_CONFIG(draganddrop)
@@ -3056,10 +3056,10 @@ void QTreeViewPrivate::initialize()
header->setStretchLastSection(true);
header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter);
q->setHeader(header);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, q) > 0;
QObject::connect(&animatedOperation, SIGNAL(finished()), q, SLOT(_q_endAnimatedOperation()));
-#endif //QT_NO_ANIMATION
+#endif // animation
}
void QTreeViewPrivate::expand(int item, bool emitSignal)
@@ -3072,10 +3072,10 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
if (index.flags() & Qt::ItemNeverHasChildren)
return;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (emitSignal && animationsEnabled)
prepareAnimatedOperation(item, QVariantAnimation::Forward);
-#endif //QT_NO_ANIMATION
+#endif // animation
//if already animating, stateBeforeAnimation is set to the correct value
if (state != QAbstractItemView::AnimatingState)
stateBeforeAnimation = state;
@@ -3089,10 +3089,10 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
model->fetchMore(index);
if (emitSignal) {
emit q->expanded(index);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (animationsEnabled)
beginAnimatedOperation();
-#endif //QT_NO_ANIMATION
+#endif // animation
}
}
@@ -3147,10 +3147,10 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal)
if (it == expandedIndexes.end() || viewItems.at(item).expanded == false)
return; // nothing to do
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (emitSignal && animationsEnabled)
prepareAnimatedOperation(item, QVariantAnimation::Backward);
-#endif //QT_NO_ANIMATION
+#endif // animation
//if already animating, stateBeforeAnimation is set to the correct value
if (state != QAbstractItemView::AnimatingState)
@@ -3168,14 +3168,14 @@ void QTreeViewPrivate::collapse(int item, bool emitSignal)
if (emitSignal) {
emit q->collapsed(modelIndex);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (animationsEnabled)
beginAnimatedOperation();
-#endif //QT_NO_ANIMATION
+#endif // animation
}
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction)
{
animatedOperation.item = item;
@@ -3280,7 +3280,7 @@ void QTreeViewPrivate::_q_endAnimatedOperation()
q->updateGeometries();
viewport->update();
}
-#endif //QT_NO_ANIMATION
+#endif // animation
void QTreeViewPrivate::_q_modelAboutToBeReset()
{
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index 09ce0e3fff..33dbf1c1ce 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -230,9 +230,9 @@ private:
Q_DECLARE_PRIVATE(QTreeView)
Q_DISABLE_COPY(QTreeView)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
Q_PRIVATE_SLOT(d_func(), void _q_endAnimatedOperation())
-#endif //QT_NO_ANIMATION
+#endif // animation
Q_PRIVATE_SLOT(d_func(), void _q_modelAboutToBeReset())
Q_PRIVATE_SLOT(d_func(), void _q_sortIndicatorChanged(int column, Qt::SortOrder order))
};
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 9a391ee88a..061bd1fc57 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -53,7 +53,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qabstractitemview_p.h"
+#if QT_CONFIG(animation)
#include <QtCore/qvariantanimation.h>
+#endif
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qvector.h>
@@ -105,7 +107,7 @@ public:
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const override;
void adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex &current) const override;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
struct AnimatedOperation : public QVariantAnimation
{
int item;
@@ -123,7 +125,7 @@ public:
void drawAnimatedOperation(QPainter *painter) const;
QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
void _q_endAnimatedOperation();
-#endif //QT_NO_ANIMATION
+#endif // animation
void expand(int item, bool emitSignal);
void collapse(int item, bool emitSignal);
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 3b9186e61a..735ae6b080 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -105,7 +105,9 @@
#include <qsettings.h>
#include <qvariant.h>
#include <qpixmapcache.h>
+#if QT_CONFIG(animation)
#include <private/qstyleanimation_p.h>
+#endif
#include <limits.h>
@@ -1195,7 +1197,7 @@ void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *w
}
#endif // QT_CONFIG(tabbar)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
/*! \internal */
QList<const QObject*> QCommonStylePrivate::animationTargets() const
{
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index f39915295e..78c5171717 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -97,7 +97,7 @@ protected:
private:
Q_DECLARE_PRIVATE(QCommonStyle)
Q_DISABLE_COPY(QCommonStyle)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
Q_PRIVATE_SLOT(d_func(), void _q_removeAnimation())
#endif
};
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index 93db75ac2d..b347c8563a 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -43,8 +43,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "qcommonstyle.h"
#include "qstyle_p.h"
+#if QT_CONFIG(animation)
#include "qstyleanimation_p.h"
-
+#endif
#include "qstyleoption.h"
QT_BEGIN_NAMESPACE
@@ -76,7 +77,7 @@ public:
~QCommonStylePrivate()
{
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
qDeleteAll(animations);
#endif
#if QT_CONFIG(itemviews)
@@ -115,7 +116,7 @@ public:
#endif
int animationFps;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void _q_removeAnimation();
QList<const QObject*> animationTargets() const;
@@ -125,7 +126,7 @@ public:
private:
mutable QHash<const QObject*, QStyleAnimation*> animations;
-#endif // QT_NO_ANIMATION
+#endif // animation
};
QT_END_NAMESPACE
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 7474cd23d6..5231f04df9 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1429,14 +1429,14 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1, 1);
if (!indeterminate) {
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
(const_cast<QFusionStylePrivate*>(d))->stopAnimation(option->styleObject);
#endif
} else {
highlightedGradientStartColor.setAlpha(120);
painter->setPen(QPen(highlightedGradientStartColor, 9.0));
painter->setClipRect(progressBar.adjusted(1, 1, -1, -1));
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)))
step = animation->animationStep() % 22;
else
@@ -2463,7 +2463,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
styleObject->setProperty("_q_stylestate", static_cast<QStyle::State::Int>(scrollBar->state));
styleObject->setProperty("_q_stylecontrols", static_cast<uint>(scrollBar->activeSubControls));
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
// if the scrollbar is transient or its attributes, geometry or
// state has changed, the opacity is reset back to 100% opaque
opacity = 1.0;
@@ -2481,10 +2481,10 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
} else if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) {
d->stopAnimation(styleObject);
}
-#endif // !QT_NO_ANIMATION
+#endif // animation
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject));
if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) {
// once a scrollbar was active (hovered/pressed), it retains
@@ -2513,7 +2513,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption
}
}
painter->setOpacity(opacity);
-#endif // !QT_NO_ANIMATION
+#endif // animation
}
bool transient = proxy()->styleHint(SH_ScrollBar_Transient, option, widget);
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 0b8e32be19..b9202eae69 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -39,8 +39,6 @@
#include "qstyleanimation_p.h"
-#ifndef QT_NO_ANIMATION
-
#include <qcoreapplication.h>
#include <qwidget.h>
#include <qevent.h>
@@ -367,5 +365,3 @@ void QScrollbarStyleAnimation::updateCurrentTime(int time)
QT_END_NAMESPACE
#include "moc_qstyleanimation_p.cpp"
-
-#endif //QT_NO_ANIMATION
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index a2ad4a91da..d28fc6ebab 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -45,9 +45,9 @@
#include "qdatetime.h"
#include "qimage.h"
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(animation);
-#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
//
// W A R N I N G
@@ -201,8 +201,6 @@ private:
bool _active;
};
-#endif // QT_NO_ANIMATION
-
QT_END_NAMESPACE
#endif // QSTYLEANIMATION_P_H
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index c046ac52f9..ceede9e72f 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -84,7 +84,9 @@
#include <qheaderview.h>
#endif
#include <private/qwindowsstyle_p_p.h>
+#if QT_CONFIG(animation)
#include <private/qstyleanimation_p.h>
+#endif
#if QT_CONFIG(tabbar)
#include <qtabbar.h>
#endif
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 7c9d917784..80ce8419f8 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -86,7 +86,9 @@
#include <private/qhighdpiscaling_p.h>
#include <private/qstylehelper_p.h>
+#if QT_CONFIG(animation)
#include <private/qstyleanimation_p.h>
+#endif
#include <algorithm>
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index 0c0f8b7bc7..821c40af81 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -3,7 +3,6 @@
HEADERS += \
styles/qdrawutil.h \
styles/qstyle.h \
- styles/qstyleanimation_p.h \
styles/qstylefactory.h \
styles/qstyleoption.h \
styles/qstyleplugin.h \
@@ -21,7 +20,6 @@ HEADERS += \
SOURCES += \
styles/qdrawutil.cpp \
styles/qstyle.cpp \
- styles/qstyleanimation.cpp \
styles/qstylefactory.cpp \
styles/qstyleoption.cpp \
styles/qstyleplugin.cpp \
@@ -37,6 +35,11 @@ RESOURCES += styles/qstyle.qrc
include($$OUT_PWD/qtwidgets-config.pri)
+qtConfig(animation) {
+ HEADERS += styles/qstyleanimation_p.h
+ SOURCES += styles/qstyleanimation.cpp
+}
+
qtConfig(style-windows) {
HEADERS += styles/qwindowsstyle_p.h styles/qwindowsstyle_p_p.h
SOURCES += styles/qwindowsstyle.cpp
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 903a141e49..ea8168b55c 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -191,7 +191,7 @@ static qreal progressForValue(const QEasingCurve &curve, qreal value)
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
class QScrollTimer : public QAbstractAnimation
{
public:
@@ -230,7 +230,7 @@ private:
bool ignoreUpdate;
int skip;
};
-#endif // QT_NO_ANIMATION
+#endif // animation
/*!
\class QScroller
@@ -896,7 +896,7 @@ QScrollerPrivate::QScrollerPrivate(QScroller *q, QObject *_target)
, snapIntervalX(0.0)
, snapFirstY(-1.0)
, snapIntervalY(0.0)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
, scrollTimer(new QScrollTimer(this))
#endif
, q_ptr(q)
@@ -938,7 +938,7 @@ const char *QScrollerPrivate::inputName(QScroller::Input input)
void QScrollerPrivate::targetDestroyed()
{
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
scrollTimer->stop();
#endif
delete q_ptr;
@@ -966,7 +966,7 @@ void QScrollerPrivate::timerTick()
}
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
scrollTimer->stop();
#endif
}
@@ -1690,7 +1690,7 @@ void QScrollerPrivate::setState(QScroller::State newstate)
switch (newstate) {
case QScroller::Inactive:
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
scrollTimer->stop();
#endif
@@ -1702,7 +1702,7 @@ void QScrollerPrivate::setState(QScroller::State newstate)
break;
case QScroller::Pressed:
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
scrollTimer->stop();
#endif
@@ -1712,14 +1712,14 @@ void QScrollerPrivate::setState(QScroller::State newstate)
case QScroller::Dragging:
dragDistance = QPointF(0, 0);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
if (state == QScroller::Pressed)
scrollTimer->start();
#endif
break;
case QScroller::Scrolling:
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
scrollTimer->start();
#endif
break;
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 5e0c359514..13e2032a5c 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -64,7 +64,9 @@
#include <qscroller.h>
#include <qscrollerproperties.h>
#include <private/qscrollerproperties_p.h>
+#if QT_CONFIG(animation)
#include <QAbstractAnimation>
+#endif
QT_BEGIN_NAMESPACE
@@ -72,7 +74,7 @@ QT_BEGIN_NAMESPACE
class QFlickGestureRecognizer;
#endif
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
class QScrollTimer;
#endif
class QScrollerPrivate : public QObject
@@ -196,7 +198,7 @@ public:
QElapsedTimer monotonicTimer;
QPointF releaseVelocity; // the starting velocity of the scrolling state
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
QScrollTimer *scrollTimer;
#endif
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 0eeff196a8..cccb44c4ef 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -57,7 +57,9 @@
#include "qlist.h"
#endif
#include <qpainter.h>
+#if QT_CONFIG(animation)
#include <qpropertyanimation.h>
+#endif
#include <qstylehints.h>
#include <qvalidator.h>
@@ -390,7 +392,7 @@ void QLineEditIconButton::setOpacity(qreal value)
}
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void QLineEditIconButton::startOpacityAnimation(qreal endValue)
{
QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity"));
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 71a67e3d10..7cd91dfc29 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -89,7 +89,7 @@ public:
qreal opacity() const { return m_opacity; }
void setOpacity(qreal value);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void animateShow(bool visible) { startOpacityAnimation(visible ? 1.0 : 0.0); }
#endif
@@ -101,7 +101,7 @@ private slots:
void updateCursor();
private:
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void startOpacityAnimation(qreal endValue);
#endif
QLineEditPrivate *lineEditPrivate() const;
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 8af70d0f9c..98e15c8f17 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -2109,13 +2109,13 @@ void QTabBarPrivate::moveTabFinished(int index)
Q_Q(QTabBar);
bool cleanup = (pressedIndex == index) || (pressedIndex == -1) || !validIndex(index);
bool allAnimationsFinished = true;
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
for(int i = 0; allAnimationsFinished && i < tabList.count(); ++i) {
const Tab &t = tabList.at(i);
if (t.animation && t.animation->state() == QAbstractAnimation::Running)
allAnimationsFinished = false;
}
-#endif //QT_NO_ANIMATION
+#endif // animation
if (allAnimationsFinished && cleanup) {
if(movingTab)
movingTab->setVisible(false); // We might not get a mouse release
@@ -2680,7 +2680,7 @@ void CloseButton::paintEvent(QPaintEvent *)
style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this);
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void QTabBarPrivate::Tab::TabBarAnimation::updateCurrentValue(const QVariant &current)
{
priv->moveTab(priv->tabList.indexOf(*tab), current.toInt());
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 1092878f2c..04f07c7cec 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -58,7 +58,9 @@
#include <qicon.h>
#include <qtoolbutton.h>
#include <qdebug.h>
+#if QT_CONFIG(animation)
#include <qvariantanimation.h>
+#endif
#define ANIMATION_DURATION 250
@@ -107,9 +109,9 @@ public:
inline Tab(const QIcon &ico, const QString &txt)
: enabled(true) , shortcutId(0), text(txt), icon(ico),
leftWidget(0), rightWidget(0), lastTab(-1), dragOffset(0)
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
, animation(0)
-#endif //QT_NO_ANIMATION
+#endif // animation
{}
bool operator==(const Tab &other) const { return &other == this; }
bool enabled;
@@ -136,7 +138,7 @@ public:
QString accessibleName;
#endif
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
~Tab() { delete animation; }
struct TabBarAnimation : public QVariantAnimation {
TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv)
@@ -166,7 +168,7 @@ public:
#else
void startAnimation(QTabBarPrivate *priv, int duration)
{ Q_UNUSED(duration); priv->moveTabFinished(priv->tabList.indexOf(*this)); }
-#endif //QT_NO_ANIMATION
+#endif // animation
};
QList<Tab> tabList;
mutable QHash<QString, QSize> textSizes;
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index b6828a14ef..b1e527e3b6 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -37,15 +37,17 @@
**
****************************************************************************/
+#include "qwidgetanimator_p.h"
+
+#if QT_CONFIG(animation)
#include <QtCore/qpropertyanimation.h>
+#endif
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qstyle.h>
#if QT_CONFIG(mainwindow)
#include <private/qmainwindowlayout_p.h>
#endif
-#include "qwidgetanimator_p.h"
-
QT_BEGIN_NAMESPACE
QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout)
@@ -54,7 +56,7 @@ QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout
void QWidgetAnimator::abort(QWidget *w)
{
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
const auto it = m_animation_map.constFind(w);
if (it == m_animation_map.cend())
return;
@@ -68,16 +70,16 @@ void QWidgetAnimator::abort(QWidget *w)
#endif
#else
Q_UNUSED(w); //there is no animation to abort
-#endif //QT_NO_ANIMATION
+#endif // animation
}
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
void QWidgetAnimator::animationFinished()
{
QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender());
abort(static_cast<QWidget*>(anim->targetObject()));
}
-#endif //QT_NO_ANIMATION
+#endif // animation
void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate)
{
@@ -91,7 +93,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :
QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size());
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
//If the QStyle has animations, animate
if (const int animationDuration = widget->style()->styleHint(QStyle::SH_Widget_Animation_Duration, 0, widget)) {
AnimationMap::const_iterator it = m_animation_map.constFind(widget);
@@ -106,7 +108,7 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
anim->start(QPropertyAnimation::DeleteWhenStopped);
} else
-#endif //QT_NO_ANIMATION
+#endif // animation
{
//we do it in one shot
widget->setGeometry(final_geometry);
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index 90be22c271..920cc3ffc8 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -73,7 +73,7 @@ public:
void abort(QWidget *widget);
-#ifndef QT_NO_ANIMATION
+#if QT_CONFIG(animation)
private Q_SLOTS:
void animationFinished();
#endif