equal
deleted
inserted
replaced
18 |
18 |
19 // System includes |
19 // System includes |
20 |
20 |
21 // User includes |
21 // User includes |
22 #include "clockcitylistproxymodel.h" |
22 #include "clockcitylistproxymodel.h" |
|
23 #include "OstTraceDefinitions.h" |
|
24 #ifdef OST_TRACE_COMPILER_IN_USE |
|
25 #include "clockcitylistproxymodelTraces.h" |
|
26 #endif |
|
27 |
23 |
28 |
24 /*! |
29 /*! |
25 \class ClockCityListProxyModel |
30 \class ClockCityListProxyModel |
26 |
31 |
27 This class acts as a filter proxy model for the city list model which we |
32 This class acts as a filter proxy model for the city list model which we |
36 \param parent of type QObject. |
41 \param parent of type QObject. |
37 */ |
42 */ |
38 ClockCityListProxyModel::ClockCityListProxyModel(QObject *parent) |
43 ClockCityListProxyModel::ClockCityListProxyModel(QObject *parent) |
39 :QSortFilterProxyModel(parent) |
44 :QSortFilterProxyModel(parent) |
40 { |
45 { |
|
46 OstTraceFunctionEntry0( CLOCKCITYLISTPROXYMODEL_CLOCKCITYLISTPROXYMODEL_ENTRY ); |
41 // Nothing yet. |
47 // Nothing yet. |
|
48 OstTraceFunctionExit0( CLOCKCITYLISTPROXYMODEL_CLOCKCITYLISTPROXYMODEL_EXIT ); |
42 } |
49 } |
43 |
50 |
44 /*! |
51 /*! |
45 From QSortFilterProxyModel. |
52 From QSortFilterProxyModel. |
46 |
53 |
50 \sa QSortFilterProxyModel. |
57 \sa QSortFilterProxyModel. |
51 */ |
58 */ |
52 bool ClockCityListProxyModel::filterAcceptsRow( |
59 bool ClockCityListProxyModel::filterAcceptsRow( |
53 int sourceRow, const QModelIndex &sourceParent) const |
60 int sourceRow, const QModelIndex &sourceParent) const |
54 { |
61 { |
|
62 OstTraceFunctionEntry0( CLOCKCITYLISTPROXYMODEL_FILTERACCEPTSROW_ENTRY ); |
55 // Get the model index of the source model. |
63 // Get the model index of the source model. |
56 QModelIndex modelIndex = sourceModel()->index( |
64 QModelIndex modelIndex = sourceModel()->index( |
57 sourceRow, filterKeyColumn(), sourceParent); |
65 sourceRow, filterKeyColumn(), sourceParent); |
58 |
66 |
59 if (!modelIndex.isValid()) { |
67 if (!modelIndex.isValid()) { |
|
68 OstTraceFunctionExit0( CLOCKCITYLISTPROXYMODEL_FILTERACCEPTSROW_EXIT ); |
60 return false; |
69 return false; |
61 } |
70 } |
62 |
71 |
63 // Get the data corresponding to that model. |
72 // Get the data corresponding to that model. |
64 int role = filterRole(); |
73 int role = filterRole(); |
69 // We just have one item and search is done only on data set with |
78 // We just have one item and search is done only on data set with |
70 // Qt::DisplayRole. |
79 // Qt::DisplayRole. |
71 if (Qt::UserRole + 100 == role) { |
80 if (Qt::UserRole + 100 == role) { |
72 QString string = modelData.value<QString>(); |
81 QString string = modelData.value<QString>(); |
73 if (string.contains(filterExp)) { |
82 if (string.contains(filterExp)) { |
|
83 OstTraceFunctionExit0( DUP1_CLOCKCITYLISTPROXYMODEL_FILTERACCEPTSROW_EXIT ); |
74 return true; |
84 return true; |
75 } |
85 } |
76 } |
86 } |
77 return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); |
87 return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); |
78 } |
88 } |