labelmodel.h

00001 /*
00002  * Silence
00003  *
00004  * Copyright (C) 2009 Manuel Unglaub
00005  *
00006  * This file is part of Silence.
00007  *
00008  * Silence is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, version GPLv2 only of the License.
00011  *
00012  * Silence is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016 
00017  * You should have received a copy of the GNU General Public License
00018  * along with Silence.  If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00021 #ifndef LABELMODEL_H
00022 #define LABELMODEL_H
00023 
00024 #include "src/data/label.h"
00025 #include <QAbstractItemModel>
00026 #include <QModelIndex>
00027 #include <QVariant>
00028 
00029 
00037 class LabelModel : public QAbstractItemModel
00038 {
00039     Q_OBJECT
00040 
00041     public:
00047         LabelModel(QObject *parent = 0);
00048 
00057         QVariant data(const QModelIndex &index, int role) const;
00058 
00065         Qt::ItemFlags flags(const QModelIndex &index) const;
00066 
00075         QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00076 
00085         QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
00086 
00093         QModelIndex parent(const QModelIndex &index) const;
00094 
00101         int rowCount(const QModelIndex &parent = QModelIndex()) const;
00102 
00109         int columnCount(const QModelIndex &parent = QModelIndex()) const;
00110 
00119         bool insertRows(int position, int rows, const QModelIndex &parent = QModelIndex());
00120 
00130         bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
00131 
00141         bool removeRows(int position, int rows, const QModelIndex &parent = QModelIndex());
00142 
00149         Label* getItem(const QModelIndex &index) const;
00150 
00151 
00152     private:
00153         Label *rootItem;
00154 
00155 };
00156 
00157 #endif // LABELMODEL_H
00158 
00159 
00160 
Generated on Fri May 14 19:12:50 2010 for Silence by  doxygen 1.6.3