digiKam
itemgpsmodelhelper.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 : 2010-07-15
7  * Description : Model for central Map view
8  *
9  * Copyright (C) 2010 by Gabriel Voicu <ping dot gabi at gmail dot com>
10  * Copyright (C) 2010-2011 by Michael G. Hansen <mike at mghansen dot de>
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) 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_ITEM_GPS_MODEL_HELPER_H
25 #define DIGIKAM_ITEM_GPS_MODEL_HELPER_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QStandardItemModel>
31 #include <QPixmap>
32 
33 // Local includes
34 
35 #include "geomodelhelper.h"
36 #include "thumbnailloadthread.h"
37 #include "gpsiteminfosorter.h"
38 
39 namespace Digikam
40 {
41 
42 const int RoleGPSItemInfo = Qt::UserRole + 1;
43 
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit ItemGPSModelHelper(QStandardItemModel* const itemModel,
51  QObject* const parent = nullptr);
52  ~ItemGPSModelHelper() override;
53 
54  QAbstractItemModel* model() const override;
55  QItemSelectionModel* selectionModel() const override;
56 
57  bool itemCoordinates(const QModelIndex& index,
58  GeoCoordinates* const coordinates) const override;
59 
60  QPixmap pixmapFromRepresentativeIndex(const QPersistentModelIndex& index,
61  const QSize& size) override;
62 
63  QPersistentModelIndex bestRepresentativeIndexFromList(const QList<QPersistentModelIndex>& list,
64  const int sortKey) override;
65 
66 private Q_SLOTS:
67 
68  void slotThumbnailLoaded(const LoadingDescription&, const QPixmap&);
69 
70 private:
71 
72  class Private;
73  Private* const d;
74 };
75 
76 } // namespace Digikam
77 
78 #endif // DIGIKAM_ITEM_GPS_MODEL_HELPER_H
Definition: geocoordinates.h:49
Helper class to access data in models.
Definition: geomodelhelper.h:47
Definition: itemgpsmodelhelper.h:45
QPixmap pixmapFromRepresentativeIndex(const QPersistentModelIndex &index, const QSize &size) override
these are used by MarkerModel for grouped models
Definition: itemgpsmodelhelper.cpp:92
bool itemCoordinates(const QModelIndex &index, GeoCoordinates *const coordinates) const override
Definition: itemgpsmodelhelper.cpp:76
QPersistentModelIndex bestRepresentativeIndexFromList(const QList< QPersistentModelIndex > &list, const int sortKey) override
Definition: itemgpsmodelhelper.cpp:121
~ItemGPSModelHelper() override
Definition: itemgpsmodelhelper.cpp:61
ItemGPSModelHelper(QStandardItemModel *const itemModel, QObject *const parent=nullptr)
Definition: itemgpsmodelhelper.cpp:45
QAbstractItemModel * model() const override
these are necessary for grouped and ungrouped models
Definition: itemgpsmodelhelper.cpp:66
QItemSelectionModel * selectionModel() const override
Definition: itemgpsmodelhelper.cpp:71
Definition: loadingdescription.h:45
Definition: datefolderview.cpp:43
const int RoleGPSItemInfo
Definition: itemgpsmodelhelper.h:42