KDeclarative

DeclarativeDropArea.h
1 /*
2  SPDX-FileCopyrightText: 2010 BetterInbox <[email protected]>
3  SPDX-FileContributor: Gregory Schlomoff <[email protected]>
4 
5  SPDX-License-Identifier: MIT
6 */
7 
8 #ifndef DECLARATIVEDROPAREA_H
9 #define DECLARATIVEDROPAREA_H
10 
11 #include <QQuickItem>
12 
13 class DeclarativeDragDropEvent;
14 
15 class DeclarativeDropArea : public QQuickItem
16 {
17  Q_OBJECT
18 
22  Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
23 
24 
27  Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
28 
29  Q_PROPERTY(bool containsDrag READ containsDrag NOTIFY containsDragChanged )
30 
31 public:
32  DeclarativeDropArea(QQuickItem *parent=nullptr);
33  bool isEnabled() const;
34  void setEnabled(bool enabled);
35 
36  bool preventStealing() const;
37  void setPreventStealing(bool prevent);
38  bool containsDrag() const;
39 
40 Q_SIGNALS:
46  void dragEnter(DeclarativeDragDropEvent* event);
47 
53  void dragLeave(DeclarativeDragDropEvent* event);
54 
60  void dragMove(DeclarativeDragDropEvent *event);
61 
67  void drop(DeclarativeDragDropEvent* event);
68 
69  //Notifiers
70  void enabledChanged();
71 
72  void preventStealingChanged();
73 
74  void containsDragChanged(bool contained);
75 
76 protected:
77  void dragEnterEvent(QDragEnterEvent *event) override;
78  void dragLeaveEvent(QDragLeaveEvent *event) override;
79  void dragMoveEvent(QDragMoveEvent *event) override;
80  void dropEvent(QDropEvent *event) override;
81 
82 private Q_SLOTS:
83  void temporaryInhibitParent(bool inhibit);
84 
85 private:
86  void setContainsDrag(bool dragging);
87 
88  bool m_enabled : 1;
89  bool m_preventStealing : 1;
90  bool m_temporaryInhibition : 1;
91  bool m_containsDrag : 1;
92  QPoint m_oldDragMovePos;
93 };
94 
95 #endif
96 
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
virtual void dragLeaveEvent(QDragLeaveEvent *event)
virtual void dragMoveEvent(QDragMoveEvent *event)
Q_PROPERTY(...)
KIOWIDGETS_EXPORT DropJob * drop(const QDropEvent *dropEvent, const QUrl &destUrl, JobFlags flags=DefaultFlags)
virtual void dropEvent(QDropEvent *event)
bool isEnabled() const const
Q_SLOTSQ_SLOTS
virtual void dragEnterEvent(QDragEnterEvent *event)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 25 2021 22:44:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.