Sayonara Player
Loading...
Searching...
No Matches
Dragable.h
1/* Dragable.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef DRAGGABLE_H
22#define DRAGGABLE_H
23
24#include "Utils/Pimpl.h"
25#include <QObject>
26
27class QPoint;
28class QPixmap;
29class QMimeData;
30class QWidget;
31class QDrag;
32class QMouseEvent;
33class QAbstractItemView;
34
35namespace Gui
36{
37 class Dragable;
39 public QObject
40 {
41 friend class Dragable;
42
43 Q_OBJECT
45
46 private:
47 DragableConnector(QAbstractItemView* widget, Dragable* dragable);
48 ~DragableConnector() override;
49
50 private slots:
51 void mousePressed(QMouseEvent* e);
52 void mouseMoved(QMouseEvent* e);
53
54 void dragDestroyed();
55 };
56
62 {
63 PIMPL(Dragable)
64 friend class DragableConnector;
65
66 public:
67 explicit Dragable(QAbstractItemView* parent);
68 virtual ~Dragable();
69
70 enum class ReleaseReason :
71 char
72 {
73 Dropped,
74 Destroyed
75 };
76
77 private:
78 QDrag* createDrag() const;
79 QDrag* moveDrag(const QPoint& p);
80 void startDrag(const QPoint& p);
81 void releaseDrag();
82
83 protected:
84 virtual bool isValidDragPosition(const QPoint& p) const;
85 virtual bool hasDragLabel() const;
86 virtual QString dragLabel() const;
87 };
88}
89
90#endif // DRAGGABLE_H
Definition Dragable.h:40
The Dragable class.
Definition Dragable.h:62