MuseScore  3.4
Music composition and notation
scorediffmodel.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2018 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __SCOREDIFFMODEL_H__
14 #define __SCOREDIFFMODEL_H__
15 
16 namespace Ms {
17 
18 struct BaseDiff;
19 class ScoreDiff;
20 struct TextDiff;
21 
22 //---------------------------------------------------------
23 // RawScoreDiffModel
24 //---------------------------------------------------------
25 
26 class RawScoreDiffModel : public QAbstractListModel {
27  Q_OBJECT
28 
30  std::vector<const TextDiff*> _textDiffs;
31  bool _skipEqual;
32 
33  public:
34  RawScoreDiffModel(ScoreDiff* d, bool skipEqual = true, QObject* parent = nullptr);
35 
36  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
37  QVariant data(const QModelIndex& index, int role) const override;
38 
39  public slots:
40  void update();
41  };
42 
43 //---------------------------------------------------------
44 // ScoreDiffModel
45 //---------------------------------------------------------
46 
47 class ScoreDiffModel : public QAbstractListModel {
48  Q_OBJECT
49 
51 
52  public:
53  ScoreDiffModel(ScoreDiff* d, QObject* parent = nullptr) : QAbstractListModel(parent), _diff(d) {}
54 
55  int rowCount(const QModelIndex& parent = QModelIndex()) const override;
56  QVariant data(const QModelIndex& index, int role) const override;
57 
58  const BaseDiff* diffItem(const QModelIndex& index) const;
59 
60  public slots:
61  void diffAboutToBeUpdated() { beginResetModel(); }
62  void diffUpdated() { endResetModel(); }
63  };
64 
65 } // namespace Ms
66 #endif
Definition: scorediff.h:135
void update()
Definition: scorediffmodel.cpp:33
RawScoreDiffModel(ScoreDiff *d, bool skipEqual=true, QObject *parent=nullptr)
Definition: scorediffmodel.cpp:23
ScoreDiff * _diff
Definition: scorediffmodel.h:29
Definition: scorediffmodel.h:47
Definition: scorediff.h:68
std::vector< const TextDiff * > _textDiffs
Definition: scorediffmodel.h:30
Definition: aeolus.cpp:26
ScoreDiffModel(ScoreDiff *d, QObject *parent=nullptr)
Definition: scorediffmodel.h:53
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: scorediffmodel.cpp:53
QVariant data(const QModelIndex &index, int role) const override
Definition: scorediffmodel.cpp:64
void diffUpdated()
Definition: scorediffmodel.h:62
void diffAboutToBeUpdated()
Definition: scorediffmodel.h:61
Definition: scorediffmodel.h:26
bool _skipEqual
Definition: scorediffmodel.h:31
ScoreDiff * _diff
Definition: scorediffmodel.h:50