diff options
Diffstat (limited to 'src/quick/items/qquickitemviewfxitem.cpp')
-rw-r--r-- | src/quick/items/qquickitemviewfxitem.cpp | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/src/quick/items/qquickitemviewfxitem.cpp b/src/quick/items/qquickitemviewfxitem.cpp index ead4a030ac..d372fde0c8 100644 --- a/src/quick/items/qquickitemviewfxitem.cpp +++ b/src/quick/items/qquickitemviewfxitem.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qquickitemviewfxitem_p_p.h" #include "qquickitem_p.h" @@ -46,7 +10,9 @@ QT_BEGIN_NAMESPACE QQuickItemViewFxItem::QQuickItemViewFxItem(QQuickItem *item, bool ownItem, QQuickItemChangeListener* changeListener) : item(item) , changeListener(changeListener) +#if QT_CONFIG(quick_viewtransitions) , transitionableItem(nullptr) +#endif , ownItem(ownItem) , releaseAfterTransition(false) , trackGeom(false) @@ -55,8 +21,10 @@ QQuickItemViewFxItem::QQuickItemViewFxItem(QQuickItem *item, bool ownItem, QQuic QQuickItemViewFxItem::~QQuickItemViewFxItem() { +#if QT_CONFIG(quick_viewtransitions) delete transitionableItem; transitionableItem = nullptr; +#endif if (ownItem && item) { trackGeometry(false); @@ -67,28 +35,47 @@ QQuickItemViewFxItem::~QQuickItemViewFxItem() qreal QQuickItemViewFxItem::itemX() const { - return transitionableItem ? transitionableItem->itemX() : (item ? item->x() : 0); + return +#if QT_CONFIG(quick_viewtransitions) + transitionableItem ? transitionableItem->itemX() : +#endif + (item ? item->x() : 0); } qreal QQuickItemViewFxItem::itemY() const { - return transitionableItem ? transitionableItem->itemY() : (item ? item->y() : 0); + return +#if QT_CONFIG(quick_viewtransitions) + transitionableItem ? transitionableItem->itemY() : +#endif + (item ? item->y() : 0); } void QQuickItemViewFxItem::moveTo(const QPointF &pos, bool immediate) { +#if QT_CONFIG(quick_viewtransitions) if (transitionableItem) transitionableItem->moveTo(pos, immediate); - else if (item) + else +#else + Q_UNUSED(immediate) +#endif + if (item) item->setPosition(pos); } void QQuickItemViewFxItem::setVisible(bool visible) { - if (!visible && transitionableItem && transitionableItem->transitionScheduledOrRunning()) + if (!visible +#if QT_CONFIG(quick_viewtransitions) + && transitionableItem && transitionableItem->transitionScheduledOrRunning() +#endif + ) return; - if (item) + if (item) { QQuickItemPrivate::get(item)->setCulled(!visible); + QQuickItemPrivate::get(item)->isAccessible = visible; + } } void QQuickItemViewFxItem::trackGeometry(bool track) @@ -123,6 +110,7 @@ void QQuickItemViewFxItem::setGeometry(const QRectF &geometry) item->setSize(geometry.size()); } +#if QT_CONFIG(quick_viewtransitions) QQuickItemViewTransitioner::TransitionType QQuickItemViewFxItem::scheduledTransitionType() const { return transitionableItem ? transitionableItem->nextTransitionType : QQuickItemViewTransitioner::NoTransition; @@ -162,6 +150,7 @@ void QQuickItemViewFxItem::startTransition(QQuickItemViewTransitioner *transitio if (transitionableItem) transitionableItem->startTransition(transitioner, index); } +#endif QT_END_NAMESPACE |