equal
deleted
inserted
replaced
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
|
18 #include <QBrush> |
|
19 |
|
20 #include "irqisdsdatastructure.h" |
17 #include "irqisdsdatastructure.h" |
21 #include "iruidefines.h" |
|
22 #include "ircategorymodel.h" |
18 #include "ircategorymodel.h" |
23 |
19 |
24 |
20 |
25 IRCategoryModel::IRCategoryModel(QObject *aParent) : QAbstractListModel(aParent), iItems(NULL) |
21 IRCategoryModel::IRCategoryModel(QObject *aParent) : QAbstractListModel(aParent), iItems(NULL) |
26 { |
22 { |
57 if (aRole == Qt::DisplayRole) |
53 if (aRole == Qt::DisplayRole) |
58 { |
54 { |
59 int row = aIndex.row(); |
55 int row = aIndex.row(); |
60 |
56 |
61 QString catNum; |
57 QString catNum; |
62 catNum.setNum(iItems->at(row)->size); |
58 catNum.sprintf(" (%d)", iItems->at(row)->size); |
63 QString secondaryText = catNum + QString(" Stations"); |
59 QString category = iItems->at(row)->catName + catNum; |
64 |
60 |
65 QVariantList list; |
61 QVariantList list; |
66 list.append(iItems->at(row)->catName); |
62 list.append(category); |
67 list.append(secondaryText); |
|
68 return list; |
63 return list; |
69 } |
|
70 else if (aRole == Qt::BackgroundRole) |
|
71 { |
|
72 if (aIndex.row() % 2 == 0) |
|
73 { |
|
74 return QBrush(KListEvenRowColor); |
|
75 } |
|
76 else |
|
77 { |
|
78 return QBrush(KListOddRowColor); |
|
79 } |
|
80 } |
64 } |
81 |
65 |
82 return QVariant(); |
66 return QVariant(); |
83 } |
67 } |
84 |
68 |