annotate data/model/TabularModel.h @ 1636:05e3ea2237f5 single-point

Add getEventsWithin
author Chris Cannam
date Wed, 13 Mar 2019 10:01:14 +0000
parents ad5f892c0c4d
children 7a23dfe65d66
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@1581 16 #ifndef SV_TABULAR_MODEL_H
Chris@1581 17 #define SV_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@462 37 virtual ~TabularModel() { }
Chris@462 38
Chris@420 39 virtual int getRowCount() const = 0;
Chris@420 40 virtual int getColumnCount() const = 0;
Chris@420 41
Chris@420 42 virtual QString getHeading(int column) const = 0;
Chris@422 43
Chris@422 44 enum { SortRole = Qt::UserRole };
Chris@422 45 enum SortType { SortNumeric, SortAlphabetical };
Chris@422 46
Chris@420 47 virtual QVariant getData(int row, int column, int role) const = 0;
Chris@422 48 virtual bool isColumnTimeValue(int col) const = 0;
Chris@422 49 virtual SortType getSortType(int col) const = 0;
Chris@420 50
Chris@1055 51 virtual sv_frame_t getFrameForRow(int row) const = 0;
Chris@1055 52 virtual int getRowForFrame(sv_frame_t frame) const = 0;
Chris@420 53
Chris@420 54 virtual bool isEditable() const { return false; }
Chris@425 55 virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; }
Chris@427 56 virtual Command *getInsertRowCommand(int /* beforeRow */) { return 0; }
Chris@427 57 virtual Command *getRemoveRowCommand(int /* row */) { return 0; }
Chris@420 58 };
Chris@420 59
Chris@420 60 #endif