File indexing completed on 2024-03-24 05:48:37
0001 /*************************************************************************** 0002 * Copyright (C) 2008 by Pino Toscano <pino@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 ***************************************************************************/ 0009 0010 #ifndef SLAVEMODEL_H 0011 #define SLAVEMODEL_H 0012 0013 #include <QAbstractItemModel> 0014 0015 class Alternative; 0016 class Item; 0017 0018 class SlaveModel : public QAbstractItemModel 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 SlaveModel(QObject *parent = Q_NULLPTR); 0024 ~SlaveModel() Q_DECL_OVERRIDE; 0025 0026 // QAbstractItemModel interface 0027 int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 0028 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 0029 bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 0030 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; 0031 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 0032 QModelIndex parent(const QModelIndex &index) const Q_DECL_OVERRIDE; 0033 int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 0034 0035 void setItem(Item *item); 0036 void setAlternative(Alternative *alt); 0037 0038 protected: 0039 Item *m_item; 0040 Alternative *m_alt; 0041 }; 0042 0043 #endif