svgui  1.9
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 _LAYER_TREE_H_
18 #define _LAYER_TREE_H_
19 
20 #include <QAbstractItemModel>
21 
22 #include <set>
23 
24 class PaneStack;
25 class View;
26 class Pane;
27 class Layer;
28 class PropertyContainer;
29 class Model;
30 
31 class ModelMetadataModel : public QAbstractItemModel
32 {
33  Q_OBJECT
34 
35 public:
36  ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent = 0);
37  virtual ~ModelMetadataModel();
38 
39  QVariant data(const QModelIndex &index, int role) const;
40 
41  bool setData(const QModelIndex &index, const QVariant &value, int role);
42 
43  Qt::ItemFlags flags(const QModelIndex &index) const;
44 
45  QVariant headerData(int section, Qt::Orientation orientation,
46  int role = Qt::DisplayRole) const;
47 
48  QModelIndex index(int row, int column,
49  const QModelIndex &parent = QModelIndex()) const;
50 
51  QModelIndex parent(const QModelIndex &index) const;
52 
53  int rowCount(const QModelIndex &parent = QModelIndex()) const;
54  int columnCount(const QModelIndex &parent = QModelIndex()) const;
55 
56 protected slots:
57  void paneAdded();
58  void paneDeleted();
59  void propertyContainerAdded(PropertyContainer *);
60  void propertyContainerRemoved(PropertyContainer *);
61  void propertyContainerSelected(PropertyContainer *);
62  void propertyContainerPropertyChanged(PropertyContainer *);
64  void paneLayerModelChanged();
65  void rebuildModelSet();
66 
67 protected:
75 
76  std::set<Model *> m_models;
77 };
78 
79 class LayerTreeModel : public QAbstractItemModel
80 {
81  Q_OBJECT
82 
83 public:
84  LayerTreeModel(PaneStack *stack, QObject *parent = 0);
85  virtual ~LayerTreeModel();
86 
87  QVariant data(const QModelIndex &index, int role) const;
88 
89  bool setData(const QModelIndex &index, const QVariant &value, int role);
90 
91  Qt::ItemFlags flags(const QModelIndex &index) const;
92 
93  QVariant headerData(int section, Qt::Orientation orientation,
94  int role = Qt::DisplayRole) const;
95 
96  QModelIndex index(int row, int column,
97  const QModelIndex &parent = QModelIndex()) const;
98 
99  QModelIndex parent(const QModelIndex &index) const;
100 
101  int rowCount(const QModelIndex &parent = QModelIndex()) const;
102  int columnCount(const QModelIndex &parent = QModelIndex()) const;
103 
104 protected slots:
105  void paneAdded();
106  void paneAboutToBeDeleted(Pane *);
107  void propertyContainerAdded(PropertyContainer *);
108  void propertyContainerRemoved(PropertyContainer *);
109  void propertyContainerSelected(PropertyContainer *);
110  void propertyContainerPropertyChanged(PropertyContainer *);
111  void paneLayerModelChanged();
113 
114 protected:
116  std::set<QObject *> m_deletedPanes;
122 };
123 
124 #endif
void paneLayerModelChanged()
Definition: LayerTree.cpp:132
Definition: Pane.h:34
virtual ~ModelMetadataModel()
Definition: LayerTree.cpp:73
The base class for visual representations of the data found in a Model.
Definition: Layer.h:52
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: LayerTree.cpp:493
std::set< QObject * > m_deletedPanes
Definition: LayerTree.h:116
int m_layerPlayedColumn
Definition: LayerTree.h:119
void propertyContainerRemoved(PropertyContainer *)
Definition: LayerTree.cpp:334
std::set< Model * > m_models
Definition: LayerTree.h:76
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:237
ModelMetadataModel(PaneStack *stack, bool waveModelsOnly, QObject *parent=0)
Definition: LayerTree.cpp:30
int m_modelNameColumn
Definition: LayerTree.h:120
PaneStack * m_stack
Definition: LayerTree.h:68
void propertyContainerRemoved(PropertyContainer *)
Definition: LayerTree.cpp:146
LayerTreeModel(PaneStack *stack, QObject *parent=0)
Definition: LayerTree.cpp:268
bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: LayerTree.cpp:209
virtual ~LayerTreeModel()
Definition: LayerTree.cpp:309
void propertyContainerSelected(PropertyContainer *)
Definition: LayerTree.cpp:340
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:584
void propertyContainerPropertyChanged(PropertyContainer *)
Definition: LayerTree.cpp:158
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:254
void propertyContainerAdded(PropertyContainer *)
Definition: LayerTree.cpp:139
QVariant data(const QModelIndex &index, int role) const
Definition: LayerTree.cpp:168
void propertyContainerPropertyChanged(PropertyContainer *)
Definition: LayerTree.cpp:352
PaneStack * m_stack
Definition: LayerTree.h:115
void propertyContainerAdded(PropertyContainer *)
Definition: LayerTree.cpp:328
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:524
void propertyContainerSelected(PropertyContainer *)
Definition: LayerTree.cpp:153
QVariant data(const QModelIndex &index, int role) const
Definition: LayerTree.cpp:397
void playParametersAudibilityChanged(bool)
Definition: LayerTree.cpp:163
Qt::ItemFlags flags(const QModelIndex &index) const
Definition: LayerTree.cpp:215
void paneAdded()
Definition: LayerTree.cpp:314
View is the base class of widgets that display one or more overlaid views of data against a horizonta...
Definition: View.h:50
void rebuildModelSet()
Definition: LayerTree.cpp:78
QModelIndex parent(const QModelIndex &index) const
Definition: LayerTree.cpp:549
void playParametersAudibilityChanged(bool)
Definition: LayerTree.cpp:369
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:261
QModelIndex parent(const QModelIndex &index) const
Definition: LayerTree.cpp:248
void paneAboutToBeDeleted(Pane *)
Definition: LayerTree.cpp:320
int m_layerVisibleColumn
Definition: LayerTree.h:118
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: LayerTree.cpp:222
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: LayerTree.cpp:509
bool setData(const QModelIndex &index, const QVariant &value, int role)
Definition: LayerTree.cpp:459
void paneLayerModelChanged()
Definition: LayerTree.cpp:346
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: LayerTree.cpp:568
int m_layerNameColumn
Definition: LayerTree.h:117