13class FoldableTrackMixin :
public QAbstractListModel
16 Q_PROPERTY (
bool folded READ folded WRITE setFolded NOTIFY foldedChanged)
22 TrackRegistry &track_registry,
23 QObject * parent =
nullptr)
noexcept;
24 ~FoldableTrackMixin ()
noexcept override =
default;
25 Z_DISABLE_COPY_MOVE (FoldableTrackMixin)
29 TrackPtrRole = Qt::UserRole + 1,
36 bool folded ()
const {
return folded_; }
37 void setFolded (
bool folded)
39 if (folded_ == folded)
43 Q_EMIT foldedChanged (folded);
45 Q_SIGNAL
void foldedChanged (
bool folded);
47 QHash<int, QByteArray> roleNames ()
const override;
48 int rowCount (
const QModelIndex &parent = QModelIndex ())
const override;
50 data (
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
55 static constexpr auto kChildrenKey =
"children"sv;
56 static constexpr auto kFoldedKey =
"folded"sv;
57 friend void to_json (nlohmann::json &j,
const FoldableTrackMixin &track);
58 friend void from_json (
const nlohmann::json &j, FoldableTrackMixin &track);
61 TrackRegistry &track_registry_;
66 std::vector<TrackUuidReference> children_;