diff options
Diffstat (limited to 'src/widgets')
25 files changed, 104 insertions, 86 deletions
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/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 282540dcd9..5c6c03d3aa 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -59,7 +59,9 @@ #include <stdlib.h> #include <qsettings.h> #include <qdebug.h> +#if QT_CONFIG(mimetype) #include <qmimedatabase.h> +#endif #include <qapplication.h> #include <qstylepainter.h> #include "ui_qfiledialog.h" @@ -1518,7 +1520,7 @@ void QFileDialog::setFilter(QDir::Filters filters) d->showHiddenAction->setChecked((filters & QDir::Hidden)); } -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) static QString nameFilterForMime(const QString &mimeType) { @@ -1599,7 +1601,7 @@ void QFileDialog::selectMimeTypeFilter(const QString &filter) } } -#endif // QT_NO_MIMETYPE +#endif // mimetype /*! * \since 5.9 @@ -1612,7 +1614,7 @@ QString QFileDialog::selectedMimeTypeFilter() const if (!d->usingWidgets()) mimeTypeFilter = d->selectedMimeTypeFilter_sys(); -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) if (mimeTypeFilter.isNull() && !d->options->mimeTypeFilters().isEmpty()) { const auto nameFilter = selectedNameFilter(); const auto mimeTypes = d->options->mimeTypeFilters(); @@ -3031,7 +3033,7 @@ void QFileDialogPrivate::createWidgets() if (!options->sidebarUrls().isEmpty()) q->setSidebarUrls(options->sidebarUrls()); q->setDirectoryUrl(options->initialDirectory()); -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) if (!options->mimeTypeFilters().isEmpty()) q->setMimeTypeFilters(options->mimeTypeFilters()); else diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index 8646894750..a4d289a77a 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -127,7 +127,7 @@ public: QString selectedMimeTypeFilter() const; QString selectedNameFilter() const; -#ifndef QT_NO_MIMETYPE +#if QT_CONFIG(mimetype) void setMimeTypeFilters(const QStringList &filters); QStringList mimeTypeFilters() const; void selectMimeTypeFilter(const QString &filter); 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(¤tAnimation, 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 779bdf36cf..f3647f656a 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1326,12 +1326,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) @@ -3049,10 +3049,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) @@ -3065,10 +3065,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; @@ -3082,10 +3082,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 } } @@ -3140,10 +3140,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) @@ -3161,14 +3161,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; @@ -3273,7 +3273,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 8b217036a2..0a0e7aae87 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 ¤t) 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 3ee3e856bc..66f5f4876e 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> @@ -1193,7 +1195,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 58478c7595..71c7f5449a 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 611de6991f..12ca5201c1 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 386fc0d103..e229a885a8 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 @@ -889,7 +889,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) @@ -931,7 +931,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; @@ -959,7 +959,7 @@ void QScrollerPrivate::timerTick() } } -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif } @@ -1683,7 +1683,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) switch (newstate) { case QScroller::Inactive: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1695,7 +1695,7 @@ void QScrollerPrivate::setState(QScroller::State newstate) break; case QScroller::Pressed: -#ifndef QT_NO_ANIMATION +#if QT_CONFIG(animation) scrollTimer->stop(); #endif @@ -1705,14 +1705,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 fce3d47b17..df8d534afa 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> @@ -389,7 +391,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 5959dd0ae4..68453e1842 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2126,13 +2126,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 @@ -2697,7 +2697,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 ¤t) { 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 3948b42bc1..9b798e89c9 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 |