Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdeclarativegeomapitemview_p.h
Go to the documentation of this file.
1// Copyright (C) 2015 Jolla Ltd.
2// Copyright (C) 2022 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QDECLARATIVEGEOMAPITEMVIEW_H
7#define QDECLARATIVEGEOMAPITEMVIEW_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtLocation/private/qlocationglobal_p.h>
21#include <map>
22#include <QtCore/QModelIndex>
23#include <QtQml/QQmlParserStatus>
24#include <QtQml/QQmlIncubator>
25#include <QtQml/qqml.h>
26#include <private/qqmldelegatemodel_p.h>
27#include <QtQuick/private/qquicktransition_p.h>
28#include <QtLocation/private/qdeclarativegeomapitemgroup_p.h>
29
30QT_BEGIN_NAMESPACE
31
32class QAbstractItemModel;
33class QQmlComponent;
34class QQuickItem;
35class QDeclarativeGeoMap;
36class QDeclarativeGeoMapItemBase;
37class QQmlOpenMetaObject;
38class QQmlOpenMetaObjectType;
39class MapItemViewDelegateIncubator;
40class QDeclarativeGeoMapItemViewItemData;
41class QDeclarativeGeoMapItemView;
42class QDeclarativeGeoMapItemGroup;
43
44class Q_LOCATION_EXPORT QDeclarativeGeoMapItemView : public QDeclarativeGeoMapItemGroup
45{
46 Q_OBJECT
47 QML_NAMED_ELEMENT(MapItemView)
48 QML_ADDED_IN_VERSION(5, 0)
49 Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
50 Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
51 Q_PROPERTY(bool autoFitViewport READ autoFitViewport WRITE setAutoFitViewport NOTIFY autoFitViewportChanged)
52 Q_PROPERTY(QQuickTransition *add MEMBER m_enter REVISION(5, 12))
53 Q_PROPERTY(QQuickTransition *remove MEMBER m_exit REVISION(5, 12))
54 Q_PROPERTY(QList<QQuickItem *> mapItems READ mapItems REVISION(5, 12))
55 Q_PROPERTY(bool incubateDelegates READ incubateDelegates WRITE setIncubateDelegates NOTIFY incubateDelegatesChanged REVISION(5, 12))
56 Q_PROPERTY(QQmlDelegateModel::DelegateModelAccess delegateModelAccess READ delegateModelAccess
57 WRITE setDelegateModelAccess NOTIFY delegateModelAccessChanged REVISION(6, 10) FINAL)
58
59
60public:
61 explicit QDeclarativeGeoMapItemView(QQuickItem *parent = nullptr);
62 ~QDeclarativeGeoMapItemView();
63
64 QVariant model() const;
65 void setModel(const QVariant &);
66
67 QQmlComponent *delegate() const;
68 void setDelegate(QQmlComponent *);
69
70 bool autoFitViewport() const;
71 void setAutoFitViewport(const bool &fit);
72
73 void setMap(QDeclarativeGeoMap *);
74 void removeInstantiatedItems(bool transition = true);
75 void instantiateAllItems();
76
77 void setIncubateDelegates(bool useIncubators);
78 bool incubateDelegates() const;
79
80 QQmlDelegateModel::DelegateModelAccess delegateModelAccess() const;
81 void setDelegateModelAccess(QQmlDelegateModel::DelegateModelAccess delegateModelAccess);
83 QList<QQuickItem *> mapItems();
84
85 // From QQmlParserStatus
86 void componentComplete() override;
87 void classBegin() override;
88
89Q_SIGNALS:
90 void modelChanged();
91 void delegateChanged();
92 void autoFitViewportChanged();
93 void incubateDelegatesChanged();
94 Q_REVISION(6, 10) void delegateModelAccessChanged();
95
96private Q_SLOTS:
97 void destroyingItem(QObject *object);
98 void initItem(int index, QObject *object);
99 void createdItem(int index, QObject *object);
100 void modelUpdated(const QQmlChangeSet &changeSet, bool reset);
101 void exitTransitionFinished();
102
103private:
104 void fitViewport();
105 void removeDelegateFromMap(int index, bool transition = true);
106 void removeDelegateFromMap(QQuickItem *o);
107 void transitionItemOut(QQuickItem *o);
108 void terminateExitTransition(QQuickItem *o);
109 QQmlInstanceModel::ReleaseFlags disposeDelegate(QQuickItem *item);
110
111 void insertInstantiatedItem(int index, QQuickItem *o, bool createdItem);
112 void addItemToMap(QDeclarativeGeoMapItemBase *item, int index, bool createdItem);
113 void addItemViewToMap(QDeclarativeGeoMapItemView *item, int index, bool createdItem);
114 void addItemGroupToMap(QDeclarativeGeoMapItemGroup *item, int index, bool createdItem);
115 void addDelegateToMap(QQuickItem *object, int index, bool createdItem = false);
116
117 QQmlIncubator::IncubationMode m_incubationMode = QQmlIncubator::Asynchronous;
118 QQmlComponent *m_delegate = nullptr;
119 QVariant m_itemModel;
120 QDeclarativeGeoMap *m_map = nullptr;
121 QList<QQuickItem *> m_instantiatedItems;
122 QQmlDelegateModel *m_delegateModel = nullptr;
123 QQuickTransition *m_enter = nullptr;
124 QQuickTransition *m_exit = nullptr;
125
126 QQmlDelegateModel::DelegateModelAccess m_delegateModelAccess
127 = QQmlDelegateModel::Qt5ReadWrite;
128
129 bool m_componentCompleted = false;
130 bool m_fitViewport = false;
131 bool m_creatingObject = false;
133 friend class QDeclarativeGeoMap;
134 friend class QDeclarativeGeoMapItemBase;
135 friend class QDeclarativeGeoMapItemTransitionManager;
136};
137
138QT_END_NAMESPACE
139
140QML_DECLARE_TYPE(QDeclarativeGeoMapItemView)
141
142#endif