equal
deleted
inserted
replaced
3 RoomsListModel::RoomsListModel(QObject *parent) : |
3 RoomsListModel::RoomsListModel(QObject *parent) : |
4 QAbstractTableModel(parent) |
4 QAbstractTableModel(parent) |
5 { |
5 { |
6 m_headerData = |
6 m_headerData = |
7 QStringList() |
7 QStringList() |
|
8 << QString() |
8 << tr("Room Name") |
9 << tr("Room Name") |
9 << tr("C") |
10 << tr("C") |
10 << tr("T") |
11 << tr("T") |
11 << tr("Owner") |
12 << tr("Owner") |
12 << tr("Map") |
13 << tr("Map") |
33 int RoomsListModel::columnCount(const QModelIndex & parent) const |
34 int RoomsListModel::columnCount(const QModelIndex & parent) const |
34 { |
35 { |
35 if(parent.isValid()) |
36 if(parent.isValid()) |
36 return 0; |
37 return 0; |
37 else |
38 else |
38 return 7; |
39 return 8; |
39 } |
40 } |
40 |
41 |
41 QVariant RoomsListModel::data(const QModelIndex &index, int role) const |
42 QVariant RoomsListModel::data(const QModelIndex &index, int role) const |
42 { |
43 { |
43 if (!index.isValid() || index.row() < 0 |
44 if (!index.isValid() || index.row() < 0 |
44 || index.row() >= m_data.size() |
45 || index.row() >= m_data.size() |
45 || index.column() >= 7 |
46 || index.column() >= 8 |
46 || (role != Qt::EditRole && role != Qt::DisplayRole) |
47 || (role != Qt::EditRole && role != Qt::DisplayRole) |
47 ) |
48 ) |
48 return QVariant(); |
49 return QVariant(); |
49 |
50 |
50 return m_data.at(index.row()).at(index.column()); |
51 return m_data.at(index.row()).at(index.column()); |
114 QStringList RoomsListModel::roomInfo2RoomRecord(const QStringList & info) |
115 QStringList RoomsListModel::roomInfo2RoomRecord(const QStringList & info) |
115 { |
116 { |
116 QStringList result; |
117 QStringList result; |
117 |
118 |
118 result = info; |
119 result = info; |
119 result.removeFirst(); |
|
120 |
120 |
121 return result; |
121 return result; |
122 } |
122 } |