| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICKSTACKELEMENT_P_P_H |
| 5 | #define QQUICKSTACKELEMENT_P_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <QtQuickTemplates2/private/qquickstackview_p.h> |
| 19 | #include <QtQuickTemplates2/private/qquickcontrol_p_p.h> |
| 20 | #if QT_CONFIG(quick_viewtransitions) |
| 21 | #include <QtQuick/private/qquickitemviewtransition_p.h> |
| 22 | #endif |
| 23 | #include <QtQuick/private/qquickitemchangelistener_p.h> |
| 24 | #include <QtQml/private/qv4persistent_p.h> |
| 25 | |
| 26 | #include <QtCore/qpointer.h> |
| 27 | |
| 28 | QT_BEGIN_NAMESPACE |
| 29 | |
| 30 | class QQmlContext; |
| 31 | class QQmlComponent; |
| 32 | struct QQuickStackTransition; |
| 33 | class RequiredProperties; |
| 34 | |
| 35 | class QQuickStackElement : |
| 36 | #if QT_CONFIG(quick_viewtransitions) |
| 37 | public QQuickItemViewTransitionableItem, |
| 38 | #endif |
| 39 | public QQuickItemChangeListener |
| 40 | { |
| 41 | QQuickStackElement(); |
| 42 | |
| 43 | public: |
| 44 | ~QQuickStackElement(); |
| 45 | |
| 46 | static QQuickStackElement *fromString(const QString &str, QQuickStackView *view, QString *error); |
| 47 | static QQuickStackElement *fromObject(QObject *object, QQuickStackView *view, QString *error); |
| 48 | static QQuickStackElement *fromStackViewArg(QQuickStackView *view, QQuickStackViewArg arg); |
| 49 | |
| 50 | bool load(QQuickStackView *parent); |
| 51 | void incubate(QObject *object, RequiredProperties *requiredProperties); |
| 52 | void initialize(RequiredProperties *requiredProperties); |
| 53 | |
| 54 | void setIndex(int index); |
| 55 | void setView(QQuickStackView *view); |
| 56 | void setStatus(QQuickStackView::Status status); |
| 57 | void setVisible(bool visible); |
| 58 | |
| 59 | #if QT_CONFIG(quick_viewtransitions) |
| 60 | void transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget); |
| 61 | bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds); |
| 62 | void startTransition(QQuickItemViewTransitioner *transitioner, QQuickStackView::Status status); |
| 63 | void completeTransition(QQuickTransition *quickTransition); |
| 64 | #endif |
| 65 | |
| 66 | void itemDestroyed(QQuickItem *item) override; |
| 67 | |
| 68 | int index = -1; |
| 69 | bool init = false; |
| 70 | bool removal = false; |
| 71 | bool ownItem = false; |
| 72 | bool ownComponent = false; |
| 73 | bool widthValid = false; |
| 74 | bool heightValid = false; |
| 75 | QQmlComponent *component = nullptr; |
| 76 | QQuickStackView *view = nullptr; |
| 77 | QPointer<QQuickItem> originalParent; |
| 78 | QQuickStackView::Status status = QQuickStackView::Inactive; |
| 79 | QV4::PersistentValue properties; |
| 80 | QV4::PersistentValue qmlCallingContext; |
| 81 | #if !QT_CONFIG(quick_viewtransitions) |
| 82 | QQuickItem *item; |
| 83 | #endif |
| 84 | }; |
| 85 | |
| 86 | QT_END_NAMESPACE |
| 87 | |
| 88 | #endif // QQUICKSTACKELEMENT_P_P_H |
| 89 | |