File indexing completed on 2024-12-22 04:40:11
0001 /* 0002 SPDX-FileCopyrightText: 2007-2009 Sergio Pistone <sergio_pistone@yahoo.com.ar> 0003 SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef LINESSELECTIONMODEL_H 0009 #define LINESSELECTIONMODEL_H 0010 0011 #include <QItemSelectionModel> 0012 #include <QSet> 0013 0014 namespace SubtitleComposer { 0015 class LinesModel; 0016 class SubtitleLine; 0017 0018 class LinesSelectionModel : public QItemSelectionModel 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 LinesSelectionModel(LinesModel *model = nullptr); 0024 0025 inline SubtitleLine * currentLine() { return m_currentLine; } 0026 0027 public slots: 0028 void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override; 0029 void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override; 0030 void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override; 0031 void clear() override; 0032 void reset() override; 0033 0034 private: 0035 bool m_resetInProgress; 0036 SubtitleLine *m_currentLine; 0037 QSet<const SubtitleLine *> m_selection; 0038 }; 0039 } 0040 0041 #endif // LINESSELECTIONMODEL_H