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