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
qquickdrag_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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
5#ifndef QQUICKDRAG_P_P_H
6#define QQUICKDRAG_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include "qquickdrag_p.h"
20
21#include <QtCore/qobject.h>
22#include <QtCore/private/qobject_p.h>
23#include <QtCore/qpointer.h>
24#include <QtCore/qurl.h>
25#include <QtCore/qvariant.h>
26
27#include <QtQuick/qquickitem.h>
28#include <QtQuick/private/qquickitemchangelistener_p.h>
29#include <QtQuick/private/qquickpixmap_p.h>
30
32
33class Q_AUTOTEST_EXPORT QQuickDragAttachedPrivate : public QObjectPrivate,
34 public QSafeQuickItemChangeListener<QQuickDragAttachedPrivate>
35{
36 Q_DECLARE_PUBLIC(QQuickDragAttached)
37 QML_ANONYMOUS
38 QML_ADDED_IN_VERSION(2, 0)
39
40public:
41 static QQuickDragAttachedPrivate *get(QQuickDragAttached *attached) {
42 return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); }
43
44 QQuickDragAttachedPrivate()
45 : attachedItem(nullptr)
46 , mimeData(nullptr)
47 , proposedAction(Qt::MoveAction)
48 , supportedActions(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction)
49 , active(false)
50 , listening(false)
51 , inEvent(false)
52 , dragRestarted(false)
53 , itemMoved(false)
54 , eventQueued(false)
55 , overrideActions(false)
56 , dragType(QQuickDrag::Internal)
57 {
58 }
59
60 void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override;
61 void itemParentChanged(QQuickItem *, QQuickItem *parent) override;
62 void updatePosition();
63 void restartDrag();
64 void deliverEnterEvent();
65 void deliverMoveEvent();
66 void deliverLeaveEvent();
67 void deliverEvent(QQuickWindow *window, QEvent *event);
68 void start(Qt::DropActions supportedActions);
69 Qt::DropAction startDrag(Qt::DropActions supportedActions);
70 void setTarget(QQuickItem *item);
71 QMimeData *createMimeData() const;
72 void loadPixmap();
73
74 QQuickDragGrabber dragGrabber;
75
76 QPointer<QObject> source;
77 QPointer<QObject> target;
78 QPointer<QQuickWindow> window;
79 QQuickItem *attachedItem;
80 QQuickDragMimeData *mimeData;
81 Qt::DropAction proposedAction;
82 Qt::DropActions supportedActions;
83 bool active : 1;
84 bool listening : 1;
85 bool inEvent : 1;
86 bool dragRestarted : 1;
87 bool itemMoved : 1;
88 bool eventQueued : 1;
89 bool overrideActions : 1;
90 QPointF hotSpot;
91 QUrl imageSource;
92 QSize imageSourceSize;
93 QQuickPixmap pixmapLoader;
94 QStringList keys;
95 QVariantMap externalMimeData;
96 QQuickDrag::DragType dragType;
97};
98
99QT_END_NAMESPACE
100
101#endif
iterator release(iterator at)
ItemList::iterator iterator
void grab(QQuickItem *item)
bool isEmpty() const
QObject * target() const
void setTarget(QObject *target)
void setProposedAction(Qt::DropAction action)
static void setProposedAction(QDropEvent *event, Qt::DropAction action)
static void copyActions(QDropEvent *to, const QDropEvent &from)
void copyActions(const QDropEvent &from)
QT_REQUIRE_CONFIG(quick_draganddrop)