digiKam
abstractitemdragdrophandler.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-04-26
7  * Description : Qt Model for Images - drag and drop handling
8  *
9  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_ABSTRACT_ITEM_DRAG_DROP_HANDLER_H
25 #define DIGIKAM_ABSTRACT_ITEM_DRAG_DROP_HANDLER_H
26 
27 // Qt includes
28 
29 #include <QAbstractItemModel>
30 
31 // Local includes
32 
33 #include "digikam_export.h"
34 
35 class QAbstractItemView;
36 class QDropEvent;
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT AbstractItemDragDropHandler : public QObject
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit AbstractItemDragDropHandler(QAbstractItemModel* const model);
48  virtual ~AbstractItemDragDropHandler();
49 
50  QAbstractItemModel* model() const;
51 
58  virtual bool dropEvent(QAbstractItemView* view, const QDropEvent* e, const QModelIndex& droppedOn);
59 
64  virtual Qt::DropAction accepts(const QDropEvent* e, const QModelIndex& dropIndex);
65 
70  virtual QStringList mimeTypes() const;
71 
75  virtual QMimeData* createMimeData(const QList<QModelIndex>&);
76 
84  virtual bool acceptsMimeData(const QMimeData* data);
85 
86 protected:
87 
88  QAbstractItemModel* m_model;
89 };
90 
91 } // namespace Digikam
92 
93 #endif // DIGIKAM_ABSTRACT_ITEM_DRAG_DROP_HANDLER_H
Definition: abstractitemdragdrophandler.h:42
QAbstractItemModel * m_model
Definition: abstractitemdragdrophandler.h:88
Definition: datefolderview.cpp:43
DropAction
Definition: itemdragdrop.cpp:60