comparison examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.d @ 323:7a3c43424dca signals

make all examples compile with new signals/slots
author eldar_ins@eldar-laptop
date Mon, 28 Dec 2009 16:28:55 +0500
parents 26036621830e
children
comparison
equal deleted inserted replaced
322:7c2cf27391c4 323:7a3c43424dca
80 invalidateFilter(); 80 invalidateFilter();
81 } 81 }
82 82
83 protected: 83 protected:
84 84
85 override bool filterAcceptsRow(int sourceRow, const QModelIndex sourceParent) 85 override bool filterAcceptsRow(int sourceRow, const QModelIndex sourceParent) const
86 { 86 {
87 QModelIndex index0 = sourceModel().index(sourceRow, 0, sourceParent); 87 QModelIndex index0 = sourceModel().index(sourceRow, 0, sourceParent);
88 QModelIndex index1 = sourceModel().index(sourceRow, 1, sourceParent); 88 QModelIndex index1 = sourceModel().index(sourceRow, 1, sourceParent);
89 QModelIndex index2 = sourceModel().index(sourceRow, 2, sourceParent); 89 QModelIndex index2 = sourceModel().index(sourceRow, 2, sourceParent);
90 90
94 return (rx2.indexIn(str, 0) != -1); 94 return (rx2.indexIn(str, 0) != -1);
95 } 95 }
96 96
97 return (contains(sourceModel().data(index0).toString(), filterRegExp()) 97 return (contains(sourceModel().data(index0).toString(), filterRegExp())
98 || contains(sourceModel().data(index1).toString(), filterRegExp())) 98 || contains(sourceModel().data(index1).toString(), filterRegExp()))
99 && dateInRange(sourceModel().data(index2).toDate()); 99 /* && dateInRange(sourceModel().data(index2).toDate())*/;
100 } 100 }
101 101
102 override bool lessThan(const QModelIndex left, const QModelIndex right) 102 override bool lessThan(const QModelIndex left, const QModelIndex right) const
103 { 103 {
104 QVariant leftData = sourceModel().data(left); 104 QVariant leftData = sourceModel().data(left);
105 QVariant rightData = sourceModel().data(right); 105 QVariant rightData = sourceModel().data(right);
106 106
107 if (leftData.type() == QVariant.Type.DateTime) { 107 if (leftData.type() == QVariant.Type.DateTime) {
120 return leftString < rightString; 120 return leftString < rightString;
121 } 121 }
122 } 122 }
123 123
124 private: 124 private:
125 125 /*
126 bool dateInRange(QDate date) 126 bool dateInRange(const QDate date) const
127 { 127 {
128 return (!minDate.isValid() || date > minDate) && (!maxDate.isValid() || date < maxDate); 128 return (!minDate.isValid() || date > minDate) && (!maxDate.isValid() || date < maxDate);
129 } 129 }
130 130 */
131 QDate minDate; 131 QDate minDate;
132 QDate maxDate; 132 QDate maxDate;
133 } 133 }