Introduce a new feature called easingcurve

features.animation and features.scroller depend on the feature.
In total, this saves around 180KB from QtCore and 75KB from QtWidgets.

Change-Id: I65aac3ec4d50d62424ee33f44b99f3cfb91121d6
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tasuku Suzuki 2019-07-16 10:31:18 +09:00
parent d0e7be8b1c
commit 37bae591b7
13 changed files with 57 additions and 11 deletions

View File

@ -1009,11 +1009,17 @@
"condition": "features.textcodec",
"output": [ "publicFeature", "feature" ]
},
"easingcurve": {
"label": "Easing curve",
"purpose": "Provides easing curve.",
"section": "Utilities",
"output": [ "publicFeature" ]
},
"animation": {
"label": "Animation",
"purpose": "Provides a framework for animations.",
"section": "Utilities",
"condition": "features.properties",
"condition": "features.properties && features.easingcurve",
"output": [ "publicFeature", "feature" ]
},
"statemachine": {

View File

@ -79,6 +79,7 @@
#define QT_NO_DATASTREAM
#define QT_FEATURE_datestring 1
#define QT_FEATURE_datetimeparser -1
#define QT_FEATURE_easingcurve -1
#define QT_FEATURE_etw -1
#define QT_FEATURE_getauxval (QT_HAS_INCLUDE(<sys/auxv.h>) ? 1 : -1)
#define QT_FEATURE_getentropy -1

View File

@ -47,7 +47,9 @@
#include "qstringlist.h"
#include "qvector.h"
#include "qlocale.h"
#if QT_CONFIG(easingcurve)
#include "qeasingcurve.h"
#endif
#include "quuid.h"
#include "qvariant.h"
#include "qdatastream.h"

View File

@ -94,6 +94,13 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
#define QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F)\
F(VoidStar, 31, void*) \
#if QT_CONFIG(easingcurve)
#define QT_FOR_EACH_STATIC_EASINGCURVE(F)\
F(QEasingCurve, 29, QEasingCurve)
#else
#define QT_FOR_EACH_STATIC_EASINGCURVE(F)
#endif
#if QT_CONFIG(itemmodel)
#define QT_FOR_EACH_STATIC_ITEMMODEL_CLASS(F)\
F(QModelIndex, 42, QModelIndex) \
@ -122,7 +129,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
F(QPoint, 25, QPoint) \
F(QPointF, 26, QPointF) \
F(QRegExp, 27, QRegExp) \
F(QEasingCurve, 29, QEasingCurve) \
QT_FOR_EACH_STATIC_EASINGCURVE(F) \
F(QUuid, 30, QUuid) \
F(QVariant, 41, QVariant) \
F(QRegularExpression, 44, QRegularExpression) \

View File

@ -206,7 +206,9 @@ template<> struct TypeDefinition<QCborArray> { static const bool IsAvailable = f
template<> struct TypeDefinition<QCborMap> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QCborSimpleType> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QCborValue> { static const bool IsAvailable = false; };
#if QT_CONFIG(easingcurve)
template<> struct TypeDefinition<QEasingCurve> { static const bool IsAvailable = false; };
#endif
template<> struct TypeDefinition<QJsonArray> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QJsonDocument> { static const bool IsAvailable = false; };
template<> struct TypeDefinition<QJsonObject> { static const bool IsAvailable = false; };

View File

@ -46,7 +46,9 @@
#include "qdebug.h"
#include "qmap.h"
#include "qdatetime.h"
#if QT_CONFIG(easingcurve)
#include "qeasingcurve.h"
#endif
#include "qlist.h"
#if QT_CONFIG(regularexpression)
#include "qregularexpression.h"
@ -2194,7 +2196,7 @@ QVariant::QVariant(const QTime &val)
QVariant::QVariant(const QDateTime &val)
: d(DateTime)
{ v_construct<QDateTime>(&d, val); }
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(easingcurve)
QVariant::QVariant(const QEasingCurve &val)
: d(EasingCurve)
{ v_construct<QEasingCurve>(&d, val); }
@ -2471,7 +2473,9 @@ static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] =
QVariant::Pen,
QVariant::LongLong,
QVariant::ULongLong,
#if QT_CONFIG(easingcurve)
QVariant::EasingCurve
#endif
};
/*!
@ -2788,7 +2792,7 @@ QDateTime QVariant::toDateTime() const
\sa canConvert(int targetTypeId), convert()
*/
#ifndef QT_BOOTSTRAPPED
#if QT_CONFIG(easingcurve)
QEasingCurve QVariant::toEasingCurve() const
{
return qVariantToHelper<QEasingCurve>(d, handlerManager);

View File

@ -66,7 +66,9 @@ class QBitArray;
class QDataStream;
class QDate;
class QDateTime;
#if QT_CONFIG(easingcurve)
class QEasingCurve;
#endif
class QLine;
class QLineF;
class QLocale;
@ -162,7 +164,9 @@ class Q_CORE_EXPORT QVariant
RegExp = QMetaType::QRegExp,
RegularExpression = QMetaType::QRegularExpression,
Hash = QMetaType::QVariantHash,
#if QT_CONFIG(easingcurve)
EasingCurve = QMetaType::QEasingCurve,
#endif
Uuid = QMetaType::QUuid,
#if QT_CONFIG(itemmodel)
ModelIndex = QMetaType::QModelIndex,
@ -254,7 +258,9 @@ class Q_CORE_EXPORT QVariant
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QVariant(const QUrl &url);
#if QT_CONFIG(easingcurve)
QVariant(const QEasingCurve &easing);
#endif
QVariant(const QUuid &uuid);
QVariant(const QJsonValue &jsonValue);
QVariant(const QJsonObject &jsonObject);
@ -328,7 +334,9 @@ class Q_CORE_EXPORT QVariant
#endif // QT_CONFIG(regularexpression)
#ifndef QT_BOOTSTRAPPED
QUrl toUrl() const;
#if QT_CONFIG(easingcurve)
QEasingCurve toEasingCurve() const;
#endif
QUuid toUuid() const;
QJsonValue toJsonValue() const;
QJsonObject toJsonObject() const;

View File

@ -41,6 +41,9 @@
#define QEASINGCURVE_H
#include <QtCore/qglobal.h>
QT_REQUIRE_CONFIG(easingcurve);
#include <QtCore/qobjectdefs.h>
#include <QtCore/qvector.h>
#if QT_DEPRECATED_SINCE(5, 0)

View File

@ -40,6 +40,10 @@
#ifndef QTIMELINE_H
#define QTIMELINE_H
#include <QtCore/qglobal.h>
QT_REQUIRE_CONFIG(easingcurve);
#include <QtCore/qeasingcurve.h>
#include <QtCore/qobject.h>

View File

@ -12,7 +12,6 @@ HEADERS += \
tools/qcontainerfwd.h \
tools/qcontainertools_impl.h \
tools/qcryptographichash.h \
tools/qeasingcurve.h \
tools/qfreelist_p.h \
tools/qhash.h \
tools/qhashfunctions.h \
@ -43,7 +42,6 @@ HEADERS += \
tools/qsimd_p.h \
tools/qsize.h \
tools/qstack.h \
tools/qtimeline.h \
tools/qtools_p.h \
tools/qvarlengtharray.h \
tools/qvector.h \
@ -54,7 +52,6 @@ SOURCES += \
tools/qarraydata.cpp \
tools/qbitarray.cpp \
tools/qcryptographichash.cpp \
tools/qeasingcurve.cpp \
tools/qfreelist.cpp \
tools/qhash.cpp \
tools/qline.cpp \
@ -72,7 +69,6 @@ SOURCES += \
tools/qsharedpointer.cpp \
tools/qsimd.cpp \
tools/qsize.cpp \
tools/qtimeline.cpp \
tools/qversionnumber.cpp
msvc: NO_PCH_SOURCES += tools/qvector_msvc.cpp
@ -104,6 +100,16 @@ qtConfig(system-doubleconversion) {
include($$PWD/../../3rdparty/double-conversion/double-conversion.pri)
}
qtConfig(easingcurve) {
HEADERS += \
tools/qeasingcurve.h \
tools/qtimeline.h
SOURCES += \
tools/qeasingcurve.cpp \
tools/qtimeline.cpp
}
# Note: libm should be present by default becaue this is C++
unix:!macx-icc:!vxworks:!haiku:!integrity:!wasm: LIBS_PRIVATE += -lm

View File

@ -68,7 +68,6 @@
#include "qdebug.h"
#include "qmap.h"
#include "qdatetime.h"
#include "qeasingcurve.h"
#include "qlist.h"
#include "qstring.h"
#include "qstringlist.h"

View File

@ -378,6 +378,7 @@
"label": "QScroller",
"purpose": "Enables kinetic scrolling for any scrolling widget or graphics item.",
"section": "Widgets",
"condition": "features.easingcurve",
"output": [ "publicFeature" ]
},
"graphicsview": {

View File

@ -4,7 +4,6 @@ qtConfig(graphicsview) {
HEADERS += graphicsview/qgraphicsgridlayout.h \
graphicsview/qgraphicsitem.h \
graphicsview/qgraphicsitem_p.h \
graphicsview/qgraphicsitemanimation.h \
graphicsview/qgraphicslayout.h \
graphicsview/qgraphicslayout_p.h \
graphicsview/qgraphicslayoutitem.h \
@ -34,7 +33,6 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \
SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qgraphicsitem.cpp \
graphicsview/qgraphicsitemanimation.cpp \
graphicsview/qgraphicslayout.cpp \
graphicsview/qgraphicslayout_p.cpp \
graphicsview/qgraphicslayoutitem.cpp \
@ -55,4 +53,9 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qsimplex_p.cpp \
graphicsview/qgraphicsanchorlayout_p.cpp \
graphicsview/qgraphicsanchorlayout.cpp
qtConfig(easingcurve) {
HEADERS += graphicsview/qgraphicsitemanimation.h
SOURCES += graphicsview/qgraphicsitemanimation.cpp
}
}