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
qquickitemsmodule.cpp
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
6
7#include "qquickitem.h"
8#include "qquickitem_p.h"
12#include "qquicktext_p.h"
16#include "qquickimage_p.h"
23#if QT_CONFIG(quick_listview)
24#include "qquicklistview_p.h"
25#endif
26#if QT_CONFIG(quick_gridview)
27#include "qquickgridview_p.h"
28#endif
29#if QT_CONFIG(quick_pathview)
30#include "qquickpathview_p.h"
31#endif
32#if QT_CONFIG(quick_tableview)
33#include "qquicktableview_p.h"
34#endif
35#if QT_CONFIG(quick_viewtransitions)
36#include "qquickitemviewtransition_p.h"
37#endif
38#if QT_CONFIG(quick_path)
39#include <private/qquickpath_p.h>
40#include <private/qquickpathinterpolator_p.h>
41#endif
42#if QT_CONFIG(quick_positioners)
43#include "qquickpositioners_p.h"
44#endif
45#if QT_CONFIG(quick_repeater)
46#include "qquickrepeater_p.h"
47#endif
48#include "qquickloader_p.h"
49#if QT_CONFIG(quick_animatedimage)
50#include "qquickanimatedimage_p.h"
51#endif
52#if QT_CONFIG(quick_flipable)
53#include "qquickflipable_p.h"
54#endif
58//#include <private/qquickpincharea_p.h>
59#if QT_CONFIG(quick_canvas)
60#include <QtQuick/private/qquickcanvasitem_p.h>
61#include <QtQuick/private/qquickcontext2d_p.h>
62#endif
64#if QT_CONFIG(quick_sprite)
65#include "qquicksprite_p.h"
66#include "qquickspritesequence_p.h"
67#include "qquickanimatedsprite_p.h"
68#endif
70#if QT_CONFIG(quick_shadereffect)
71#include <QtQuick/private/qquickshadereffectsource_p.h>
72#include "qquickshadereffect_p.h"
73#include "qquickshadereffectmesh_p.h"
74#endif
75#if QT_CONFIG(quick_draganddrop)
76#include "qquickdrag_p.h"
77#include "qquickdroparea_p.h"
78#endif
80#include <QtQuick/private/qquickaccessibleattached_p.h>
81
82#include "handlers/qquickdraghandler_p.h"
83#include "handlers/qquickhoverhandler_p.h"
84#include "handlers/qquickpinchhandler_p.h"
85#include "handlers/qquickpointhandler_p.h"
86#include "handlers/qquicktaphandler_p.h"
87#include "handlers/qquickwheelhandler_p.h"
88
89#include "moc_qquickitemsmodule_p.cpp"
90
91static QQmlPrivate::AutoParentResult qquickitem_autoParent(QObject *obj, QObject *parent)
92{
93 if (QQuickItem *parentItem = qmlobject_cast<QQuickItem *>(parent)) {
94 if (QQuickItem *item = qmlobject_cast<QQuickItem *>(obj)) {
95 // An Item has another Item
96 item->setParentItem(parentItem);
97 return QQmlPrivate::Parented;
98 } else if (QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj)) {
99 QQuickItemPrivate::get(parentItem)->addPointerHandler(handler);
100 handler->setParent(parent);
101 return QQmlPrivate::Parented;
102 }
103 return QQmlPrivate::IncompatibleObject;
104 } else if (QQuickWindow *parentWindow = qmlobject_cast<QQuickWindow *>(parent)) {
105 if (QQuickItem *item = qmlobject_cast<QQuickItem *>(obj)) {
106 // The parent of an Item inside a Window is actually the implicit content Item
107 item->setParentItem(parentWindow->contentItem());
108 return QQmlPrivate::Parented;
109 } else if (QQuickPointerHandler *handler = qmlobject_cast<QQuickPointerHandler *>(obj)) {
110 QQuickItemPrivate::get(parentWindow->contentItem())->addPointerHandler(handler);
111 handler->setParent(parentWindow->contentItem());
112 return QQmlPrivate::Parented;
113 }
114 return QQmlPrivate::IncompatibleObject;
115 } else if (qmlobject_cast<QQuickItem *>(obj)) {
116 return QQmlPrivate::IncompatibleParent;
117 }
118 return QQmlPrivate::IncompatibleObject;
119}
120
122{
123 QQmlPrivate::RegisterAutoParent autoparent = { 0, &qquickitem_autoParent };
124 QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent);
125
126 qRegisterMetaType<QQuickAnchorLine>("QQuickAnchorLine");
127 qRegisterMetaType<QQuickHandlerPoint>();
128}
129
130//static void initResources()
131//{
132// Q_INIT_RESOURCE(items);
133//}
134
135QT_BEGIN_NAMESPACE
136
137void QQuickItemsModule::defineModule()
138{
139// initResources();
141}
142
143/*!
144 \qmltype PointerEvent
145 \nativetype QPointerEvent
146 \inqmlmodule QtQuick
147 \brief QML equivalent for \l QPointerEvent.
148
149 PointerEvent is the QML name of the QPointerEvent class.
150*/
151
152/*!
153 \qmltype PointerDevice
154 \nativetype QPointingDevice
155 \inqmlmodule QtQuick
156 \brief QML equivalent for \l QPointingDevice.
157
158 PointerDevice is the QML name of the QPointingDevice class.
159 It has the same properties and enums as \l QPointingDevice.
160*/
161
162/*!
163 \qmlproperty enumeration PointerDevice::deviceType
164
165 This property tells the type of device that generated a PointerEvent.
166
167 Valid values are:
168
169 \value PointerDevice.Unknown The device cannot be identified.
170 \value PointerDevice.Mouse A mouse.
171 \value PointerDevice.TouchScreen A touchscreen.
172 \value PointerDevice.TouchPad A touchpad or trackpad.
173 \value PointerDevice.Stylus A stylus on a graphics tablet.
174 \value PointerDevice.Airbrush An airbrush on a graphics tablet.
175 \value PointerDevice.Puck A digitizer with crosshairs, on a graphics tablet.
176
177 \sa QInputDevice::DeviceType, PointerDeviceHandler::acceptedDevices
178*/
179
180/*!
181 \qmlproperty enumeration PointerDevice::pointerType
182
183 This property tells what is interacting with the PointerDevice.
184
185 There is some redundancy between this property and \l deviceType.
186 For example, if a touchscreen is used, then \c deviceType is
187 \c TouchScreen and \c pointerType is \c Finger. But on a graphics
188 tablet, it's often possible for both ends of the stylus to be used,
189 and programs need to distinguish them.
190 \l PointerDeviceHandler::acceptedDevices and
191 \l PointerDeviceHandler::acceptedPointerTypes can be used in combination
192 to filter the subset of events that a particular handler should react to.
193
194 Valid values are:
195
196 \value PointerDevice.Unknown The device cannot be identified.
197 \value PointerDevice.Generic A mouse or a device that emulates a mouse.
198 \value PointerDevice.Finger A finger on a touchscreen.
199 \value PointerDevice.Pen A stylus on a graphics tablet.
200 \value PointerDevice.Eraser An eraser on a graphics tablet.
201 \value PointerDevice.Cursor A digitizer with crosshairs, on a graphics tablet.
202
203 \sa QPointingDevice::PointerType, PointerDeviceHandler::acceptedPointerTypes
204*/
205
206/*!
207 \qmlproperty int PointerDevice::maximumPoints
208
209 This property tells the maximum number of simultaneous touch points
210 (fingers) that can be detected.
211*/
212
213/*!
214 \qmlproperty int PointerDevice::buttonCount
215
216 This property tells the maximum number of on-device buttons that can be
217 detected.
218*/
219
220/*!
221 \qmltype pointingDeviceUniqueId
222 \nativetype QPointingDeviceUniqueId
223 \inqmlmodule QtQuick
224 \brief QML equivalent for \l QPointingDeviceUniqueId.
225
226 pointingDeviceUniqueId is the QML name of the QPointingDeviceUniqueId class.
227*/
228
229/*!
230 \qmlproperty qint64 pointingDeviceUniqueId::numericId
231
232 This property gives the numeric ID of the \l PointerDevice, if available;
233 otherwise it is \c -1.
234*/
235
236/*!
237 \qmlproperty pointingDeviceUniqueId PointerDevice::uniqueId
238
239 This property may provide a unique ID for the device, if available. For
240 example, a graphics tablet stylus device may have a unique serial number.
241
242 \sa eventPoint, QEventPoint::uniqueId()
243*/
244
245/*!
246 \qmlsignal PointerDevice::grabChanged(QtObject grabber, enumeration transition, PointerEvent event, eventPoint point)
247
248 This signal is emitted when the \a grabber object gains or loses an
249 exclusive or passive grab of \a point during delivery of \a event.
250 The \a transition tells what happened, from the perspective of the
251 \c grabber object, which may be either an \l Item or an
252 \l {Qt Quick Input Handlers}{Input Handler}.
253
254 Valid values for \a transition are:
255
256 \value PointerDevice.GrabExclusive
257 The \a grabber has taken primary responsibility for handling the \a point.
258 \value PointerDevice.UngrabExclusive
259 The \a grabber has given up its previous exclusive grab.
260 \value PointerDevice.CancelGrabExclusive
261 The exclusive grab of \a grabber has been taken over or cancelled.
262 \value PointerDevice.GrabPassive
263 The \a grabber has acquired a passive grab, to monitor the \a point.
264 \value PointerDevice.UngrabPassive
265 The \a grabber has given up its previous passive grab.
266 \value PointerDevice.CancelGrabPassive
267 The previous passive grab has terminated abnormally.
268
269 \note A grab transition from one object to another results in two signals,
270 to notify that one object has lost its grab, and to notify that there is
271 another grabber. In other cases, when transitioning to or from a non-grabbing
272 state, only one signal is emitted.
273
274 \sa QPointerEvent::setExclusiveGrabber(), QPointerEvent::addPassiveGrabber(),
275 QPointerEvent::removePassiveGrabber(), PointerHandler::grabChanged()
276*/
277
278QT_END_NAMESPACE
static void qt_quickitems_defineModule()