File indexing completed on 2024-05-12 16:40:13
0001 /* This file is part of the KDE project 0002 Copyright (C) 2009 Adam Pigg <adam@piggz.co.uk> 0003 Copyright (C) 2009-2016 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License version 2 as published by the Free Software Foundation. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef ALTERSCHEMATABLEMODEL_H 0021 #define ALTERSCHEMATABLEMODEL_H 0022 0023 #include <QModelIndex> 0024 #include <QList> 0025 0026 #include <KDbRecordData> 0027 0028 class KDbTableSchema; 0029 0030 class AlterSchemaTableModel : public QAbstractTableModel 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit AlterSchemaTableModel(QObject* parent = nullptr); 0035 ~AlterSchemaTableModel(); 0036 0037 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; 0038 virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0039 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override; 0040 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override; 0041 0042 void setSchema(KDbTableSchema *schema); 0043 void setData(QList<KDbRecordData*> *data); 0044 void setRowCount(int i); 0045 private: 0046 //! Reimplemented just to avoid 'hidden' warnings 0047 bool setData(const QModelIndex & index, const QVariant & value, 0048 int role = Qt::EditRole) override 0049 { 0050 return QAbstractTableModel::setData(index, value, role); 0051 } 0052 0053 KDbTableSchema *m_schema; 0054 QList<KDbRecordData*> *m_data; //!< Small amount of data to display to user 0055 int m_recordCount; 0056 }; 0057 0058 #endif // ALTERSCHEMATABLEMODEL_H