File indexing completed on 2025-01-19 03:50:35
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-04-16 0007 * Description : Qt Model for Items - drag and drop handling 0008 * 0009 * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * SPDX-FileCopyrightText: 2002-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_ITEM_DRAG_DROP_H 0017 #define DIGIKAM_ITEM_DRAG_DROP_H 0018 0019 // Qt includes 0020 0021 #include <QUrl> 0022 0023 // Local includes 0024 0025 #include "iteminfo.h" 0026 #include "abstractitemdragdrophandler.h" 0027 #include "itemalbummodel.h" 0028 0029 namespace Digikam 0030 { 0031 0032 class ItemDragDropHandler : public AbstractItemDragDropHandler 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 0038 explicit ItemDragDropHandler(ItemModel* const model); 0039 0040 ItemModel* model() const; 0041 ItemAlbumModel* albumModel() const; 0042 0043 /** 0044 * Enables a mode in which dropping will never start an operation 0045 * which copies or moves files on disk. 0046 * Only the signals are emitted. 0047 */ 0048 void setReadOnlyDrop(bool readOnly); 0049 0050 bool dropEvent(QAbstractItemView* view, 0051 const QDropEvent* e, 0052 const QModelIndex& droppedOn) override; 0053 0054 Qt::DropAction accepts(const QDropEvent* e, 0055 const QModelIndex& dropIndex) override; 0056 0057 QStringList mimeTypes() const override; 0058 QMimeData* createMimeData(const QList<QModelIndex>&) override; 0059 0060 Q_SIGNALS: 0061 0062 void itemInfosDropped(const QList<ItemInfo>& infos); 0063 void urlsDropped(const QList<QUrl>& urls); 0064 void assignTags(const QList<ItemInfo>& list, const QList<int>& tagIDs); 0065 void addToGroup(const ItemInfo& pick, const QList<ItemInfo>& infos); 0066 void dragDropSort(const ItemInfo& pick, const QList<ItemInfo>& infos); 0067 0068 protected: 0069 0070 bool m_readOnly; 0071 }; 0072 0073 } // namespace Digikam 0074 0075 #endif // DIGIKAM_ITEM_DRAG_DROP_H