diff options
author | Liang Qi <liang.qi@qt.io> | 2018-10-17 10:35:28 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-10-17 10:35:28 +0200 |
commit | ccf26f6a88e116abdf8e53acdc02dbd98a4a8dc4 (patch) | |
tree | 40aaca99471edc709d38e6f82153576bad86747f /src/widgets/itemviews | |
parent | 8ff1ae89bfa32c586e3b44b71dfc49d294a3e043 (diff) | |
parent | 3eebadc1734463afa469dcd08eab8c5d2557dec6 (diff) |
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
src/plugins/platformthemes/platformthemes.pro
src/printsupport/kernel/qplatformprintdevice.cpp
Change-Id: Iac01729ad954bb1c7af5867d982eb243b2139ee6
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r-- | src/widgets/itemviews/qcolumnview.cpp | 16 | ||||
-rw-r--r-- | src/widgets/itemviews/qcolumnview_p.h | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.cpp | 28 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview.h | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreeview_p.h | 6 |
5 files changed, 31 insertions, 27 deletions
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); |