annotate data/model/TabularModel.h @ 426:2386582f67cd

* build fix
author Chris Cannam
date Mon, 16 Jun 2008 07:55:35 +0000
parents f5e8f12d2e58
children 72ec275e458b
rev   line source
Chris@420 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@420 2
Chris@420 3 /*
Chris@420 4 Sonic Visualiser
Chris@420 5 An audio file viewer and annotation editor.
Chris@420 6 Centre for Digital Music, Queen Mary, University of London.
Chris@420 7 This file copyright 2008 QMUL.
Chris@420 8
Chris@420 9 This program is free software; you can redistribute it and/or
Chris@420 10 modify it under the terms of the GNU General Public License as
Chris@420 11 published by the Free Software Foundation; either version 2 of the
Chris@420 12 License, or (at your option) any later version. See the file
Chris@420 13 COPYING included with this distribution for more information.
Chris@420 14 */
Chris@420 15
Chris@420 16 #ifndef _TABULAR_MODEL_H_
Chris@420 17 #define _TABULAR_MODEL_H_
Chris@420 18
Chris@420 19 #include <QVariant>
Chris@420 20 #include <QString>
Chris@420 21
Chris@420 22 class Command;
Chris@420 23
Chris@420 24 /**
Chris@420 25 * TabularModel is an abstract base class for models that support
Chris@420 26 * direct access to data in a tabular form. A model that implements
Chris@420 27 * TabularModel may be displayed and, perhaps, edited in a data
Chris@420 28 * spreadsheet window.
Chris@420 29 *
Chris@420 30 * This is very like a cut-down QAbstractItemModel. It assumes a
Chris@420 31 * relationship between row number and frame time.
Chris@420 32 */
Chris@420 33
Chris@420 34 class TabularModel
Chris@420 35 {
Chris@420 36 public:
Chris@420 37 virtual int getRowCount() const = 0;
Chris@420 38 virtual int getColumnCount() const = 0;
Chris@420 39
Chris@420 40 virtual QString getHeading(int column) const = 0;
Chris@422 41
Chris@422 42 enum { SortRole = Qt::UserRole };
Chris@422 43 enum SortType { SortNumeric, SortAlphabetical };
Chris@422 44
Chris@420 45 virtual QVariant getData(int row, int column, int role) const = 0;
Chris@422 46 virtual bool isColumnTimeValue(int col) const = 0;
Chris@422 47 virtual SortType getSortType(int col) const = 0;
Chris@420 48
Chris@420 49 virtual long getFrameForRow(int row) const = 0;
Chris@420 50 virtual int getRowForFrame(long frame) const = 0;
Chris@420 51
Chris@420 52 virtual bool isEditable() const { return false; }
Chris@425 53 virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; }
Chris@420 54 };
Chris@420 55
Chris@420 56 #endif