1// Copyright (C) 2016 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 QQUICKLOADER_P_P_H
5#define QQUICKLOADER_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 "qquickloader_p.h"
19#include "qquickimplicitsizeitem_p_p.h"
20#include "qquickitemchangelistener_p.h"
21#include <qqmlincubator.h>
22
23#include <private/qv4staticvalue_p.h>
24#include <private/qv4persistent_p.h>
25
26QT_BEGIN_NAMESPACE
27
28
29class QQuickLoaderPrivate;
30class QQuickLoaderIncubator : public QQmlIncubator
31{
32public:
33 QQuickLoaderIncubator(QQuickLoaderPrivate *l, IncubationMode mode) : QQmlIncubator(mode), loader(l) {}
34
35protected:
36 void statusChanged(Status) override;
37 void setInitialState(QObject *) override;
38
39private:
40 QQuickLoaderPrivate *loader;
41};
42
43class QQmlContext;
44class QQuickLoaderPrivate : public QQuickImplicitSizeItemPrivate, public QQuickItemChangeListener
45{
46 Q_DECLARE_PUBLIC(QQuickLoader)
47
48public:
49 QQuickLoaderPrivate();
50 ~QQuickLoaderPrivate();
51
52 void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &oldGeometry) override;
53 void itemImplicitWidthChanged(QQuickItem *) override;
54 void itemImplicitHeightChanged(QQuickItem *) override;
55 void clear();
56 void initResize();
57 void load();
58
59 void incubatorStateChanged(QQmlIncubator::Status status);
60 void setInitialState(QObject *o);
61 void disposeInitialPropertyValues();
62 QQuickLoader::Status computeStatus() const;
63 void updateStatus();
64 void createComponent();
65
66 qreal getImplicitWidth() const override;
67 qreal getImplicitHeight() const override;
68
69 QUrl source;
70 QQuickItem *item;
71 QObject *object;
72 QQmlStrongJSQObjectReference<QQmlComponent> component;
73 QQmlContext *itemContext;
74 QQuickLoaderIncubator *incubator;
75 QV4::PersistentValue initialPropertyValues;
76 QV4::PersistentValue qmlCallingContext;
77 bool updatingSize: 1;
78 bool active : 1;
79 bool loadingFromSource : 1;
80 bool asynchronous : 1;
81 // We need to use char instead of QQuickLoader::Status
82 // as otherwise the size of the class would increase
83 // on 32-bit systems, as sizeof(Status) == sizeof(int)
84 // and sizeof(int) > remaining padding on 32 bit
85 char status;
86
87 void _q_sourceLoaded();
88 void _q_updateSize(bool loaderGeometryChanged = true);
89};
90
91QT_END_NAMESPACE
92
93#endif // QQUICKLOADER_P_P_H
94

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtdeclarative/src/quick/items/qquickloader_p_p.h