| 1 | // Copyright (C) 2020 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 QQUICKCONTAINER_P_P_H |
| 5 | #define QQUICKCONTAINER_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/qquickcontainer_p.h> |
| 19 | #include <QtQuickTemplates2/private/qquickcontrol_p_p.h> |
| 20 | #include <private/qqmlobjectmodel_p.h> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class Q_QUICKTEMPLATES2_EXPORT QQuickContainerPrivate : public QQuickControlPrivate |
| 25 | { |
| 26 | public: |
| 27 | Q_DECLARE_PUBLIC(QQuickContainer) |
| 28 | |
| 29 | static QQuickContainerPrivate *get(QQuickContainer *container) |
| 30 | { |
| 31 | return container->d_func(); |
| 32 | } |
| 33 | |
| 34 | void init(); |
| 35 | void cleanup(); |
| 36 | |
| 37 | QQuickItem *itemAt(int index) const; |
| 38 | void insertItem(int index, QQuickItem *item); |
| 39 | void moveItem(int from, int to, QQuickItem *item); |
| 40 | void removeItem(int index, QQuickItem *item); |
| 41 | void reorderItems(); |
| 42 | void maybeCullItem(QQuickItem *item); |
| 43 | void maybeCullItems(); |
| 44 | |
| 45 | void _q_currentIndexChanged(); |
| 46 | |
| 47 | void itemChildAdded(QQuickItem *item, QQuickItem *child) override; |
| 48 | void itemSiblingOrderChanged(QQuickItem *item) override; |
| 49 | void itemParentChanged(QQuickItem *item, QQuickItem *parent) override; |
| 50 | void itemDestroyed(QQuickItem *item) override; |
| 51 | |
| 52 | static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj); |
| 53 | static qsizetype contentData_count(QQmlListProperty<QObject> *prop); |
| 54 | static QObject *contentData_at(QQmlListProperty<QObject> *prop, qsizetype index); |
| 55 | static void contentData_clear(QQmlListProperty<QObject> *prop); |
| 56 | |
| 57 | static void contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *obj); |
| 58 | static qsizetype contentChildren_count(QQmlListProperty<QQuickItem> *prop); |
| 59 | static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index); |
| 60 | static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop); |
| 61 | |
| 62 | void updateContentWidth(); |
| 63 | void updateContentHeight(); |
| 64 | |
| 65 | bool hasContentWidth = false; |
| 66 | bool hasContentHeight = false; |
| 67 | qreal contentWidth = 0; |
| 68 | qreal contentHeight = 0; |
| 69 | QObjectList contentData; |
| 70 | QQmlObjectModel *contentModel = nullptr; |
| 71 | qsizetype currentIndex = -1; |
| 72 | bool updatingCurrent = false; |
| 73 | QQuickItemPrivate::ChangeTypes changeTypes = Destroyed | Parent | SiblingOrder; |
| 74 | }; |
| 75 | |
| 76 | QT_END_NAMESPACE |
| 77 | |
| 78 | #endif // QQUICKCONTAINER_P_P_H |
| 79 | |