File indexing completed on 2025-01-19 03:57:44

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-03-18
0007  * Description : Drag-and-drop handler for geolocation interface used in the demo
0008  *
0009  * SPDX-FileCopyrightText: 2010 by Michael G. Hansen <mike at mghansen dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_GEO_MY_DRAG_DROP_HANDLER_H
0016 #define DIGIKAM_GEO_MY_DRAG_DROP_HANDLER_H
0017 
0018 // Qt includes
0019 
0020 #include <QAbstractItemModel>
0021 #include <QMimeData>
0022 #include <QTreeWidgetItem>
0023 
0024 // Local includes
0025 
0026 #include "geodragdrophandler.h"
0027 
0028 using namespace Digikam;
0029 
0030 class MyDragData : public QMimeData
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035 
0036     MyDragData()
0037         : QMimeData     (),
0038           draggedIndices()
0039     {
0040     }
0041 
0042     QList<QPersistentModelIndex> draggedIndices;
0043 };
0044 
0045 class MyDragDropHandler : public GeoDragDropHandler
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050 
0051     explicit MyDragDropHandler(QAbstractItemModel* const pModel, QObject* const parent = nullptr);
0052     ~MyDragDropHandler()                                                                    override;
0053 
0054     Qt::DropAction accepts(const QDropEvent* e) override;
0055     bool           dropEvent(const QDropEvent* e, const GeoCoordinates& dropCoordinates)    override;
0056     QMimeData*     createMimeData(const QList<QPersistentModelIndex>& modelIndices)         override;
0057 
0058 private:
0059 
0060     QAbstractItemModel* const model;
0061 };
0062 
0063 #endif // DIGIKAM_GEO_MY_DRAG_DROP_HANDLER_H