comparison data/model/TabularModel.h @ 420:50a956688baa

* reorganise tabular data editor model support
author Chris Cannam
date Wed, 11 Jun 2008 16:13:25 +0000
parents
children 397fe91dc8e0
comparison
equal deleted inserted replaced
419:64e7bbb255d3 420:50a956688baa
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
24 /**
25 * TabularModel is an abstract base class for models that support
26 * direct access to data in a tabular form. A model that implements
27 * TabularModel may be displayed and, perhaps, edited in a data
28 * spreadsheet window.
29 *
30 * This is very like a cut-down QAbstractItemModel. It assumes a
31 * relationship between row number and frame time.
32 */
33
34 class TabularModel
35 {
36 public:
37 virtual int getRowCount() const = 0;
38 virtual int getColumnCount() const = 0;
39
40 virtual QString getHeading(int column) const = 0;
41 virtual QVariant getData(int row, int column, int role) const = 0;
42
43 virtual long getFrameForRow(int row) const = 0;
44 virtual int getRowForFrame(long frame) const = 0;
45
46 virtual bool isColumnTimeValue(int col) const = 0;
47
48 virtual bool isEditable() const { return false; }
49 virtual Command *setData(int row, int column, const QVariant &, int role)
50 { return 0; }
51 };
52
53 #endif