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_PRIVATE_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 | |
43 | void _q_currentIndexChanged(); |
44 | |
45 | void itemChildAdded(QQuickItem *item, QQuickItem *child) override; |
46 | void itemSiblingOrderChanged(QQuickItem *item) override; |
47 | void itemParentChanged(QQuickItem *item, QQuickItem *parent) override; |
48 | void itemDestroyed(QQuickItem *item) override; |
49 | |
50 | static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj); |
51 | static qsizetype contentData_count(QQmlListProperty<QObject> *prop); |
52 | static QObject *contentData_at(QQmlListProperty<QObject> *prop, qsizetype index); |
53 | static void contentData_clear(QQmlListProperty<QObject> *prop); |
54 | |
55 | static void contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *obj); |
56 | static qsizetype contentChildren_count(QQmlListProperty<QQuickItem> *prop); |
57 | static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, qsizetype index); |
58 | static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop); |
59 | |
60 | void updateContentWidth(); |
61 | void updateContentHeight(); |
62 | |
63 | bool hasContentWidth = false; |
64 | bool hasContentHeight = false; |
65 | qreal contentWidth = 0; |
66 | qreal contentHeight = 0; |
67 | QObjectList contentData; |
68 | QQmlObjectModel *contentModel = nullptr; |
69 | qsizetype currentIndex = -1; |
70 | bool updatingCurrent = false; |
71 | QQuickItemPrivate::ChangeTypes changeTypes = Destroyed | Parent | SiblingOrder; |
72 | }; |
73 | |
74 | QT_END_NAMESPACE |
75 | |
76 | #endif // QQUICKCONTAINER_P_P_H |
77 | |