digiKam
track_listmodel.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 : 2014-06-09
7  * Description : A model to list the tracks
8  *
9  * Copyright (C) 2014-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2014 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)
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_TRACK_LISTMODEL_H
26 #define DIGIKAM_TRACK_LISTMODEL_H
27 
28 // Qt includes
29 
30 #include <QAbstractItemModel>
31 
32 // Local includes
33 
34 #include "trackmanager.h"
35 
36 namespace Digikam
37 {
38 
39 class TrackListModel : public QAbstractItemModel
40 {
41  Q_OBJECT
42 
43 public:
44 
45  explicit TrackListModel(TrackManager* const trackManager, QObject* const parent);
46  ~TrackListModel() override;
47 
48  // QAbstractItemModel customization:
49 
50  int columnCount(const QModelIndex& parent = QModelIndex() ) const override;
51  bool setData(const QModelIndex& index, const QVariant& value, int role) override;
52  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
53  QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
54  QModelIndex parent(const QModelIndex& index) const override;
55  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
56  bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role) override;
57  QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
58  Qt::ItemFlags flags(const QModelIndex& index) const override;
59 
60  TrackManager::Track getTrackForIndex(const QModelIndex& index) const;
61 
62 private Q_SLOTS:
63 
64  void slotTrackManagerUpdated();
65 
66 private:
67 
68  class Private;
69  const QScopedPointer<Private> d;
70 };
71 
72 } // namespace Digikam
73 
74 #endif // DIGIKAM_TRACK_LISTMODEL_H
Definition: track_listmodel.h:40
TrackListModel(TrackManager *const trackManager, QObject *const parent)
Definition: track_listmodel.cpp:58
TrackManager::Track getTrackForIndex(const QModelIndex &index) const
Definition: track_listmodel.cpp:269
QModelIndex parent(const QModelIndex &index) const override
Definition: track_listmodel.cpp:176
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) override
Definition: track_listmodel.cpp:200
~TrackListModel() override
Definition: track_listmodel.cpp:68
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: track_listmodel.cpp:188
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition: track_listmodel.cpp:154
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: track_listmodel.cpp:246
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition: track_listmodel.cpp:72
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Definition: track_listmodel.cpp:210
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition: track_listmodel.cpp:88
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Definition: track_listmodel.cpp:79
Definition: trackmanager.h:100
Definition: trackmanager.h:46
qulonglong value
Definition: itemviewutilities.cpp:592
@ Orientation
Definition: coredbfields.h:86
Definition: datefolderview.cpp:43