LayerTree.h
Go to the documentation of this file.
1 
2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
3 
4 /*
5  Sonic Visualiser
6  An audio file viewer and annotation editor.
7  Centre for Digital Music, Queen Mary, University of London.
8  This file copyright 2006 Chris Cannam.
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License as
12  published by the Free Software Foundation; either version 2 of the
13  License, or (at your option) any later version. See the file
14  COPYING included with this distribution for more information.
15 */
16 
17 #ifndef SV_LAYER_TREE_H
18 #define SV_LAYER_TREE_H
19 
20 #include <QAbstractItemModel>
21 
22 #include "data/model/Model.h"
23 
24 #include <set>
25 
26 class PaneStack;
27 class View;
28 class Pane;
29 class Layer;
30 class PropertyContainer;
31 
32 class ModelMetadataModel : public QAbstractItemModel
33 {
34  Q_OBJECT
35 
36 public:
37  ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
38  virtual ~ModelMetadataModel();
39 
40  QVariant data(const QModelIndex &index, int role) const override;
41 
42  bool setData(const QModelIndex &index, const QVariant &value, int role) override;
43 
44  Qt::ItemFlags flags(const QModelIndex &index) const override;
45 
46  QVariant headerData(int section, Qt::Orientation orientation,
47  int role = Qt::DisplayRole) const override;
48 
49  QModelIndex index(int row, int column,
50  const QModelIndex &parent = QModelIndex()) const override;
51 
52  QModelIndex parent(const QModelIndex &index) const override;
53 
54  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
55  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
56 
57 protected slots:
58  void paneAdded();
59  void paneDeleted();
60  void propertyContainerAdded(PropertyContainer *);
61  void propertyContainerRemoved(PropertyContainer *);
62  void propertyContainerSelected(PropertyContainer *);
63  void propertyContainerPropertyChanged(PropertyContainer *);
65  void paneLayerModelChanged();
66  void rebuildModelSet();
67 
68 protected:
76 
77  std::set<ModelId> m_models;
78 };
79 
80 class LayerTreeModel : public QAbstractItemModel
81 {
82  Q_OBJECT
83 
84 public:
85  LayerTreeModel(PaneStack *stack, QObject *parent = 0);
86  virtual ~LayerTreeModel();
87 
88  QVariant data(const QModelIndex &index, int role) const override;
89 
90  bool setData(const QModelIndex &index, const QVariant &value, int role) override;
91 
92  Qt::ItemFlags flags(const QModelIndex &index) const override;
93 
94  QVariant headerData(int section, Qt::Orientation orientation,
95  int role = Qt::DisplayRole) const override;
96 
97  QModelIndex index(int row, int column,
98  const QModelIndex &parent = QModelIndex()) const override;
99 
100  QModelIndex parent(const QModelIndex &index) const override;
101 
102  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
103  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
104 
105 protected slots:
106  void paneAdded();
107  void paneAboutToBeDeleted(Pane *);
108  void propertyContainerAdded(PropertyContainer *);
109  void propertyContainerRemoved(PropertyContainer *);
110  void propertyContainerSelected(PropertyContainer *);
111  void propertyContainerPropertyChanged(PropertyContainer *);
112  void paneLayerModelChanged();
114 
115 protected:
117  std::set<QObject *> m_deletedPanes;
123 };
124 
125 #endif
void paneLayerModelChanged()
Definition: LayerTree.cpp:129
Definition: Pane.h:35
virtual ~ModelMetadataModel()
Definition: LayerTree.cpp:73
The base class for visual representations of the data found in a Model.
Definition: Layer.h:54
std::set< QObject * > m_deletedPanes
Definition: LayerTree.h:117
int m_layerPlayedColumn
Definition: LayerTree.h:120
QVariant data(const QModelIndex &index, int role) const override
Definition: LayerTree.cpp:165
Qt::ItemFlags flags(const QModelIndex &index) const override
Definition: LayerTree.cpp:213
ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent=0)
Definition: LayerTree.cpp:30
int m_modelNameColumn
Definition: LayerTree.h:121
QModelIndex parent(const QModelIndex &index) const override
Definition: LayerTree.cpp:246
PaneStack * m_stack
Definition: LayerTree.h:69
void propertyContainerRemoved(PropertyContainer *)
Definition: LayerTree.cpp:143
void propertyContainerPropertyChanged(PropertyContainer *)
Definition: LayerTree.cpp:155
void propertyContainerAdded(PropertyContainer *)
Definition: LayerTree.cpp:136
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Definition: LayerTree.cpp:235
PaneStack * m_stack
Definition: LayerTree.h:116
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Definition: LayerTree.cpp:259
void propertyContainerSelected(PropertyContainer *)
Definition: LayerTree.cpp:150
std::set< ModelId > m_models
Definition: LayerTree.h:77
void playParametersAudibilityChanged(bool)
Definition: LayerTree.cpp:160
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Definition: View.h:55
void rebuildModelSet()
Definition: LayerTree.cpp:78
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Definition: LayerTree.cpp:220
bool setData(const QModelIndex &index, const QVariant &value, int role) override
Definition: LayerTree.cpp:207
int m_layerVisibleColumn
Definition: LayerTree.h:119
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition: LayerTree.cpp:252
int m_layerNameColumn
Definition: LayerTree.h:118