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 , executingNativeDrag(false)
53 , dragRestarted(false)
54 , itemMoved(false)
55 , eventQueued(false)
56 , overrideActions(false)
57 , dragType(QQuickDrag::Internal)
58 {
59 }
60
61 void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override;
62 void itemParentChanged(QQuickItem *, QQuickItem *parent) override;
63 void updatePosition();
64 void restartDrag();
65 void deliverEnterEvent();
66 void deliverMoveEvent();
67 void deliverLeaveEvent();
68 void deliverEvent(QQuickWindow *window, QEvent *event);
69 void start(Qt::DropActions supportedActions);
70 Qt::DropAction startDrag(Qt::DropActions supportedActions);
71 void setTarget(QQuickItem *item);
72 QMimeData *createMimeData() const;
73 void loadPixmap();
74
75 QQuickDragGrabber dragGrabber;
76
77 QPointer<QObject> source;
78 QPointer<QObject> target;
79 QPointer<QQuickWindow> window;
80 QQuickItem *attachedItem;
81 QQuickDragMimeData *mimeData;
82 Qt::DropAction proposedAction;
83 Qt::DropActions supportedActions;
84 bool active : 1;
85 bool listening : 1;
86 bool inEvent : 1;
87 bool executingNativeDrag : 1;
88 bool dragRestarted : 1;
89 bool itemMoved : 1;
90 bool eventQueued : 1;
91 bool overrideActions : 1;
92 QPointF hotSpot;
93 QUrl imageSource;
94 QSize imageSourceSize;
95 QQuickPixmap pixmapLoader;
96 QStringList keys;
97 QVariantMap externalMimeData;
98 QQuickDrag::DragType dragType;
99};
100
101QT_END_NAMESPACE
102
103#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)
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(quick_draganddrop)