blob: d51641e533df8d8b3e5bc524055c5c4018cdfef6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QQUICKFILEDIALOGDELEGATE_P_P_H
#define QQUICKFILEDIALOGDELEGATE_P_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qquickfiledialogimpl_p.h"
#include "qquickfiledialogimpl_p_p.h"
#include "qquickfolderdialogimpl_p.h"
#include "qquickfiledialogdelegate_p.h"
#include <QtQuick/private/qquicksinglepointhandler_p.h>
#include <QtQuick/private/qquicktaphandler_p.h>
#include <QtQuick/private/qquickdroparea_p.h>
#include <QtQuickTemplates2/private/qquickitemdelegate_p_p.h>
#include <QtGui/qdrag.h>
QT_BEGIN_NAMESPACE
class QQuickFileDialogTapHandler : public QQuickTapHandler
{
Q_OBJECT
public:
explicit QQuickFileDialogTapHandler(QQuickItem *parent);
enum State {
Listening, // the pointer is not being pressed
Tracking, // the pointer is being pressed
DraggingStarted, // dragging started
Dragging, // a drag is ongoing
DraggingFinished // dragging finished
};
State state() { return m_state; }
QQuickFileDialogImpl *getFileDialogImpl() const;
void grabFolder();
QUrl getFolderUrlAtPress() const;
void handleDrag(QQuickDragEvent *event);
void handleDrop(QQuickDragEvent *event);
void handleContainsDragChanged();
friend class QQuickFileDialogDelegatePrivate;
protected:
void handleEventPoint(QPointerEvent *event, QEventPoint &point) override;
bool wantsEventPoint(const QPointerEvent *event, const QEventPoint &point) override;
private:
void resetDragData();
QPointer<QDrag> m_drag;
QPointer<QQuickDropArea> m_dropArea;
State m_state = Listening;
QUrl m_sourceUrl;
bool m_longPressed = false;
};
class QQuickFileDialogDelegatePrivate : public QQuickItemDelegatePrivate
{
public:
Q_DECLARE_PUBLIC(QQuickFileDialogDelegate)
static QQuickFileDialogDelegatePrivate *get(QQuickFileDialogDelegate *delegate)
{
return delegate->d_func();
}
void highlightFile();
void chooseFile();
void initTapHandler();
void destroyTapHandler();
void handleLongPress();
bool acceptKeyClick(Qt::Key key) const override;
QQuickDialog *dialog = nullptr;
QQuickFileDialogImpl *fileDialog = nullptr;
QQuickFolderDialogImpl *folderDialog = nullptr;
QQuickFileDialogTapHandler *tapHandler = nullptr;
QUrl file;
};
QT_END_NAMESPACE
#endif // QQUICKFILEDIALOGDELEGATE_P_P_H
|