File indexing completed on 2025-01-05 03:58:31
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2010-03-22 0007 * Description : Drag-and-drop handler for geolocation interface integration. 0008 * 0009 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2010 by Michael G. Hansen <mike at mghansen dot de> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_MAP_DRAG_DROP_HANDLER_H 0017 #define DIGIKAM_MAP_DRAG_DROP_HANDLER_H 0018 0019 // Qt includes 0020 0021 #include <QAbstractItemModel> 0022 #include <QMimeData> 0023 0024 // Local includes 0025 0026 #include "geodragdrophandler.h" 0027 #include "digikam_export.h" 0028 0029 namespace Digikam 0030 { 0031 0032 class GPSGeoIfaceModelHelper; 0033 0034 class DIGIKAM_EXPORT MapDragData : public QMimeData 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 explicit MapDragData() 0041 : QMimeData (), 0042 draggedIndices() 0043 { 0044 } 0045 0046 QList<QPersistentModelIndex> draggedIndices; 0047 0048 private: 0049 0050 // Disable 0051 explicit MapDragData(QObject*) = delete; 0052 }; 0053 0054 // ----------------------------------------------------------------------------------- 0055 0056 class DIGIKAM_EXPORT MapDragDropHandler : public GeoDragDropHandler 0057 { 0058 Q_OBJECT 0059 0060 public: 0061 0062 explicit MapDragDropHandler(QAbstractItemModel* const /*pModel*/, 0063 GPSGeoIfaceModelHelper* const parent); 0064 ~MapDragDropHandler() override; 0065 0066 Qt::DropAction accepts(const QDropEvent* e) override; 0067 bool dropEvent(const QDropEvent* e, const GeoCoordinates& dropCoordinates) override; 0068 QMimeData* createMimeData(const QList<QPersistentModelIndex>& modelIndices) override; 0069 0070 private: 0071 0072 GPSGeoIfaceModelHelper* const gpsGeoIfaceModelHelper; 0073 }; 0074 0075 } // namespace Digikam 0076 0077 #endif // DIGIKAM_MAP_DRAG_DROP_HANDLER_H