svcore  1.9
TabularModel.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2008 QMUL.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef _TABULAR_MODEL_H_
17 #define _TABULAR_MODEL_H_
18 
19 #include <QVariant>
20 #include <QString>
21 
22 class Command;
23 
35 {
36 public:
37  virtual ~TabularModel() { }
38 
39  virtual int getRowCount() const = 0;
40  virtual int getColumnCount() const = 0;
41 
42  virtual QString getHeading(int column) const = 0;
43 
44  enum { SortRole = Qt::UserRole };
46 
47  virtual QVariant getData(int row, int column, int role) const = 0;
48  virtual bool isColumnTimeValue(int col) const = 0;
49  virtual SortType getSortType(int col) const = 0;
50 
51  virtual long getFrameForRow(int row) const = 0;
52  virtual int getRowForFrame(long frame) const = 0;
53 
54  virtual bool isEditable() const { return false; }
55  virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; }
56  virtual Command *getInsertRowCommand(int /* beforeRow */) { return 0; }
57  virtual Command *getRemoveRowCommand(int /* row */) { return 0; }
58 };
59 
60 #endif
virtual Command * getSetDataCommand(int, int, const QVariant &, int)
Definition: TabularModel.h:55
virtual int getRowForFrame(long frame) const =0
virtual int getRowCount() const =0
virtual bool isEditable() const
Definition: TabularModel.h:54
virtual long getFrameForRow(int row) const =0
virtual SortType getSortType(int col) const =0
TabularModel is an abstract base class for models that support direct access to data in a tabular for...
Definition: TabularModel.h:34
virtual QVariant getData(int row, int column, int role) const =0
virtual QString getHeading(int column) const =0
virtual ~TabularModel()
Definition: TabularModel.h:37
virtual Command * getRemoveRowCommand(int)
Definition: TabularModel.h:57
virtual Command * getInsertRowCommand(int)
Definition: TabularModel.h:56
virtual int getColumnCount() const =0
virtual bool isColumnTimeValue(int col) const =0