File indexing completed on 2024-04-28 15:39:08

0001 // SPDX-FileCopyrightText: 2021-2022 Tobias Leupold <tl at stonemx dot de>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 #ifndef TRACKSLISTVIEW_H
0006 #define TRACKSLISTVIEW_H
0007 
0008 // Qt includes
0009 #include <QListView>
0010 
0011 // Local classes
0012 class GeoDataModel;
0013 
0014 // Qt classes
0015 class QMenu;
0016 class QAction;
0017 
0018 class TracksListView : public QListView
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit TracksListView(GeoDataModel *model, QWidget *parent = nullptr);
0024     QVector<int> selectedTracks() const;
0025 
0026 Q_SIGNALS:
0027     void trackSelected(const QModelIndex &index);
0028     void removeTracks();
0029     void updateTrackWalker(int row);
0030 
0031 protected:
0032     void currentChanged(const QModelIndex &current, const QModelIndex &) override;
0033 
0034 private Q_SLOTS:
0035     void showContextMenu(const QPoint &point);
0036     void checkSelection();
0037 
0038 private: // Variables
0039     QMenu *m_contextMenu;
0040     QAction *m_remove;
0041 
0042 };
0043 
0044 #endif // TRACKSLISTVIEW_H