itom 1.3.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef USERMODEL_H 00024 #define USERMODEL_H 00025 00026 #include <qabstractitemmodel.h> 00027 00028 namespace ito 00029 { 00034 struct UserInfoStruct 00035 { 00036 UserInfoStruct(QString sname, QString sid, QString siniFile, QString srole) : name(sname), id(sid), iniFile(siniFile), role(srole) {} 00037 QString name; 00038 QString id; 00039 QString iniFile; 00040 QString role; 00041 }; 00042 00049 class UserModel : public QAbstractItemModel 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 UserModel(/*const QString &data, QObject *parent = 0*/); 00055 ~UserModel(); 00056 00057 QVariant data(const QModelIndex &index, int role) const; 00058 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 00059 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; 00060 QModelIndex parent(const QModelIndex &index) const; 00061 int rowCount(const QModelIndex &parent = QModelIndex()) const; 00062 int columnCount(const QModelIndex &parent = QModelIndex()) const; 00063 int addUser(const UserInfoStruct &newUser); 00064 00065 private: 00066 QList<QString> m_headers; 00067 QList<QVariant> m_alignment; 00068 QList<UserInfoStruct> m_userInfo; 00069 }; 00070 } 00071 00072 #endif //USERMODEL_H