1881
|
1 |
/*
|
|
2 |
* Hedgewars, a free turn based strategy game
|
|
3 |
* Copyright (c) 2009 Andrey Korotaev <unC0Rr@gmail.com>
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
7 |
* the Free Software Foundation; version 2 of the License
|
|
8 |
*
|
|
9 |
* This program is distributed in the hope that it will be useful,
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
* GNU General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU General Public License
|
|
15 |
* along with this program; if not, write to the Free Software
|
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include <QModelIndex>
|
|
20 |
#include "ammoSchemeModel.h"
|
|
21 |
|
|
22 |
AmmoSchemeModel::AmmoSchemeModel(QObject* parent) :
|
|
23 |
QAbstractTableModel(parent)
|
|
24 |
{
|
|
25 |
|
|
26 |
}
|
|
27 |
|
|
28 |
QVariant AmmoSchemeModel::headerData(int section, Qt::Orientation orientation, int role) const
|
|
29 |
{
|
|
30 |
return QVariant();
|
|
31 |
}
|
|
32 |
|
|
33 |
int AmmoSchemeModel::rowCount(const QModelIndex &parent) const
|
|
34 |
{
|
|
35 |
if (parent.isValid())
|
|
36 |
return 0;
|
|
37 |
else
|
|
38 |
return schemes.size();
|
|
39 |
}
|
|
40 |
|
|
41 |
int AmmoSchemeModel::columnCount(const QModelIndex & parent) const
|
|
42 |
{
|
|
43 |
if (parent.isValid())
|
|
44 |
return 0;
|
|
45 |
else
|
|
46 |
return 3;
|
|
47 |
}
|
|
48 |
|
|
49 |
Qt::ItemFlags AmmoSchemeModel::flags(const QModelIndex & index) const
|
|
50 |
{
|
|
51 |
return
|
|
52 |
Qt::ItemIsEnabled
|
|
53 |
| Qt::ItemIsSelectable
|
|
54 |
| Qt::ItemIsEditable;
|
|
55 |
}
|
|
56 |
|
|
57 |
bool AmmoSchemeModel::setData(const QModelIndex & index, const QVariant & value, int role)
|
|
58 |
{
|
|
59 |
emit dataChanged(index, index);
|
|
60 |
}
|