digiKam
itemdragdrop.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-16
7  * Description : Qt Model for Items - drag and drop handling
8  *
9  * Copyright (C) 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2002-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_ITEM_DRAG_DROP_H
26 #define DIGIKAM_ITEM_DRAG_DROP_H
27 
28 // Qt includes
29 
30 #include <QUrl>
31 
32 // Local includes
33 
34 #include "iteminfo.h"
36 #include "itemalbummodel.h"
37 
38 namespace Digikam
39 {
40 
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit ItemDragDropHandler(ItemModel* const model);
48 
49  ItemModel* model() const;
50  ItemAlbumModel* albumModel() const;
51 
57  void setReadOnlyDrop(bool readOnly);
58 
59  bool dropEvent(QAbstractItemView* view,
60  const QDropEvent* e,
61  const QModelIndex& droppedOn) override;
62 
63  Qt::DropAction accepts(const QDropEvent* e,
64  const QModelIndex& dropIndex) override;
65 
66  QStringList mimeTypes() const override;
67  QMimeData* createMimeData(const QList<QModelIndex>&) override;
68 
69 Q_SIGNALS:
70 
71  void itemInfosDropped(const QList<ItemInfo>& infos);
72  void urlsDropped(const QList<QUrl>& urls);
73  void assignTags(const QList<ItemInfo>& list, const QList<int>& tagIDs);
74  void addToGroup(const ItemInfo& pick, const QList<ItemInfo>& infos);
75  void dragDropSort(const ItemInfo& pick, const QList<ItemInfo>& infos);
76 
77 protected:
78 
79  bool m_readOnly;
80 };
81 
82 } // namespace Digikam
83 
84 #endif // DIGIKAM_ITEM_DRAG_DROP_H
Definition: abstractitemdragdrophandler.h:42
Definition: itemalbummodel.h:47
Definition: itemdragdrop.h:42
ItemAlbumModel * albumModel() const
Definition: itemdragdrop.cpp:265
ItemDragDropHandler(ItemModel *const model)
Definition: itemdragdrop.cpp:254
void assignTags(const QList< ItemInfo > &list, const QList< int > &tagIDs)
bool m_readOnly
Definition: itemdragdrop.h:79
void dragDropSort(const ItemInfo &pick, const QList< ItemInfo > &infos)
void setReadOnlyDrop(bool readOnly)
Definition: itemdragdrop.cpp:270
QMimeData * createMimeData(const QList< QModelIndex > &) override
Definition: itemdragdrop.cpp:816
ItemModel * model() const
Definition: itemdragdrop.cpp:260
bool dropEvent(QAbstractItemView *view, const QDropEvent *e, const QModelIndex &droppedOn) override
Definition: itemdragdrop.cpp:275
void urlsDropped(const QList< QUrl > &urls)
void itemInfosDropped(const QList< ItemInfo > &infos)
QStringList mimeTypes() const override
Definition: itemdragdrop.cpp:803
void addToGroup(const ItemInfo &pick, const QList< ItemInfo > &infos)
Qt::DropAction accepts(const QDropEvent *e, const QModelIndex &dropIndex) override
Definition: itemdragdrop.cpp:764
Definition: iteminfo.h:78
Definition: itemmodel.h:53
Definition: datefolderview.cpp:43
DropAction
Definition: itemdragdrop.cpp:60