| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | typedef QList<QPair<QModelIndex, QPersistentModelIndex> > QModelIndexPairList; | - |
| 10 | | - |
| 11 | static inline QSet<int> qVectorToSet(const QVector<int> &vector) | - |
| 12 | { | - |
| 13 | QSet<int> set; | - |
| 14 | set.reserve(vector.size()); | - |
| 15 | for(int i=0; i < vector.size(); ++i) evaluated: i < vector.size()| yes Evaluation Count:83 | yes Evaluation Count:753 |
| 83-753 |
| 16 | set << vector.at(i); executed: set << vector.at(i);Execution Count:83 | 83 |
| 17 | return set; executed: return set;Execution Count:753 | 753 |
| 18 | } | - |
| 19 | | - |
| 20 | class QSortFilterProxyModelLessThan | - |
| 21 | { | - |
| 22 | public: | - |
| 23 | inline QSortFilterProxyModelLessThan(int column, const QModelIndex &parent, | - |
| 24 | const QAbstractItemModel *source, | - |
| 25 | const QSortFilterProxyModel *proxy) | - |
| 26 | : sort_column(column), source_parent(parent), source_model(source), proxy_model(proxy) {} executed: }Execution Count:234 | 234 |
| 27 | | - |
| 28 | inline bool operator()(int r1, int r2) const | - |
| 29 | { | - |
| 30 | QModelIndex i1 = source_model->index(r1, sort_column, source_parent); | - |
| 31 | QModelIndex i2 = source_model->index(r2, sort_column, source_parent); | - |
| 32 | return proxy_model->lessThan(i1, i2); executed: return proxy_model->lessThan(i1, i2);Execution Count:87096 | 87096 |
| 33 | } | - |
| 34 | | - |
| 35 | private: | - |
| 36 | int sort_column; | - |
| 37 | QModelIndex source_parent; | - |
| 38 | const QAbstractItemModel *source_model; | - |
| 39 | const QSortFilterProxyModel *proxy_model; | - |
| 40 | }; | - |
| 41 | | - |
| 42 | class QSortFilterProxyModelGreaterThan | - |
| 43 | { | - |
| 44 | public: | - |
| 45 | inline QSortFilterProxyModelGreaterThan(int column, const QModelIndex &parent, | - |
| 46 | const QAbstractItemModel *source, | - |
| 47 | const QSortFilterProxyModel *proxy) | - |
| 48 | : sort_column(column), source_parent(parent), | - |
| 49 | source_model(source), proxy_model(proxy) {} executed: }Execution Count:19 | 19 |
| 50 | | - |
| 51 | inline bool operator()(int r1, int r2) const | - |
| 52 | { | - |
| 53 | QModelIndex i1 = source_model->index(r1, sort_column, source_parent); | - |
| 54 | QModelIndex i2 = source_model->index(r2, sort_column, source_parent); | - |
| 55 | return proxy_model->lessThan(i2, i1); executed: return proxy_model->lessThan(i2, i1);Execution Count:171 | 171 |
| 56 | } | - |
| 57 | | - |
| 58 | private: | - |
| 59 | int sort_column; | - |
| 60 | QModelIndex source_parent; | - |
| 61 | const QAbstractItemModel *source_model; | - |
| 62 | const QSortFilterProxyModel *proxy_model; | - |
| 63 | }; | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | | - |
| 68 | | - |
| 69 | struct QRowsRemoval | - |
| 70 | { | - |
| 71 | QRowsRemoval(const QModelIndex &parent_source, int start, int end) : parent_source(parent_source), start(start), end(end) | - |
| 72 | { | - |
| 73 | } executed: }Execution Count:45 | 45 |
| 74 | | - |
| 75 | QRowsRemoval() : start(-1), end(-1) | - |
| 76 | { | - |
| 77 | } executed: }Execution Count:309 | 309 |
| 78 | | - |
| 79 | bool contains(QModelIndex parent, int row) | - |
| 80 | { | - |
| 81 | do { | - |
| 82 | if (parent == parent_source) partially evaluated: parent == parent_source| yes Evaluation Count:304 | no Evaluation Count:0 |
| 0-304 |
| 83 | return row >= start && row <= end; executed: return row >= start && row <= end;Execution Count:304 | 304 |
| 84 | row = parent.row(); | - |
| 85 | parent = parent.parent(); | - |
| 86 | } while (row >= 0); never evaluated: row >= 0 | 0 |
| 87 | return false; never executed: return false; | 0 |
| 88 | } | - |
| 89 | private: | - |
| 90 | QModelIndex parent_source; | - |
| 91 | int start; | - |
| 92 | int end; | - |
| 93 | }; | - |
| 94 | | - |
| 95 | class QSortFilterProxyModelPrivate : public QAbstractProxyModelPrivate | - |
| 96 | { | - |
| 97 | inline QSortFilterProxyModel* q_func() { return static_cast<QSortFilterProxyModel *>(q_ptr); } inline const QSortFilterProxyModel* q_func() const { return static_cast<const QSortFilterProxyModel *>(q_ptr); } friend class QSortFilterProxyModel; | - |
| 98 | | - |
| 99 | public: | - |
| 100 | struct Mapping { | - |
| 101 | QVector<int> source_rows; | - |
| 102 | QVector<int> source_columns; | - |
| 103 | QVector<int> proxy_rows; | - |
| 104 | QVector<int> proxy_columns; | - |
| 105 | QVector<QModelIndex> mapped_children; | - |
| 106 | QHash<QModelIndex, Mapping *>::const_iterator map_iter; | - |
| 107 | }; | - |
| 108 | | - |
| 109 | mutable QHash<QModelIndex, Mapping*> source_index_mapping; | - |
| 110 | | - |
| 111 | int source_sort_column; | - |
| 112 | int proxy_sort_column; | - |
| 113 | Qt::SortOrder sort_order; | - |
| 114 | Qt::CaseSensitivity sort_casesensitivity; | - |
| 115 | int sort_role; | - |
| 116 | bool sort_localeaware; | - |
| 117 | | - |
| 118 | int filter_column; | - |
| 119 | QRegExp filter_regexp; | - |
| 120 | int filter_role; | - |
| 121 | | - |
| 122 | bool dynamic_sortfilter; | - |
| 123 | QRowsRemoval itemsBeingRemoved; | - |
| 124 | | - |
| 125 | QModelIndexPairList saved_persistent_indexes; | - |
| 126 | | - |
| 127 | QHash<QModelIndex, Mapping *>::const_iterator create_mapping( | - |
| 128 | const QModelIndex &source_parent) const; | - |
| 129 | QModelIndex proxy_to_source(const QModelIndex &proxyIndex) const; | - |
| 130 | QModelIndex source_to_proxy(const QModelIndex &sourceIndex) const; | - |
| 131 | bool can_create_mapping(const QModelIndex &source_parent) const; | - |
| 132 | | - |
| 133 | void remove_from_mapping(const QModelIndex &source_parent); | - |
| 134 | | - |
| 135 | inline QHash<QModelIndex, Mapping *>::const_iterator index_to_iterator( | - |
| 136 | const QModelIndex &proxy_index) const | - |
| 137 | { | - |
| 138 | qt_noop(); | - |
| 139 | qt_noop(); | - |
| 140 | const void *p = proxy_index.internalPointer(); | - |
| 141 | qt_noop(); | - |
| 142 | QHash<QModelIndex, Mapping *>::const_iterator it = | - |
| 143 | static_cast<const Mapping*>(p)->map_iter; | - |
| 144 | qt_noop(); | - |
| 145 | qt_noop(); | - |
| 146 | return it; executed: return it;Execution Count:131324 | 131324 |
| 147 | } | - |
| 148 | | - |
| 149 | inline QModelIndex create_index(int row, int column, | - |
| 150 | QHash<QModelIndex, Mapping*>::const_iterator it) const | - |
| 151 | { | - |
| 152 | return q_func()->createIndex(row, column, *it); executed: return q_func()->createIndex(row, column, *it);Execution Count:114988 | 114988 |
| 153 | } | - |
| 154 | | - |
| 155 | void _q_sourceDataChanged(const QModelIndex &source_top_left, | - |
| 156 | const QModelIndex &source_bottom_right); | - |
| 157 | void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end); | - |
| 158 | | - |
| 159 | void _q_sourceAboutToBeReset(); | - |
| 160 | void _q_sourceReset(); | - |
| 161 | | - |
| 162 | void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); | - |
| 163 | void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); | - |
| 164 | | - |
| 165 | void _q_sourceRowsAboutToBeInserted(const QModelIndex &source_parent, | - |
| 166 | int start, int end); | - |
| 167 | void _q_sourceRowsInserted(const QModelIndex &source_parent, | - |
| 168 | int start, int end); | - |
| 169 | void _q_sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, | - |
| 170 | int start, int end); | - |
| 171 | void _q_sourceRowsRemoved(const QModelIndex &source_parent, | - |
| 172 | int start, int end); | - |
| 173 | void _q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, | - |
| 174 | int sourceStart, int sourceEnd, | - |
| 175 | const QModelIndex &destParent, int dest); | - |
| 176 | void _q_sourceRowsMoved(const QModelIndex &sourceParent, | - |
| 177 | int sourceStart, int sourceEnd, | - |
| 178 | const QModelIndex &destParent, int dest); | - |
| 179 | void _q_sourceColumnsAboutToBeInserted(const QModelIndex &source_parent, | - |
| 180 | int start, int end); | - |
| 181 | void _q_sourceColumnsInserted(const QModelIndex &source_parent, | - |
| 182 | int start, int end); | - |
| 183 | void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &source_parent, | - |
| 184 | int start, int end); | - |
| 185 | void _q_sourceColumnsRemoved(const QModelIndex &source_parent, | - |
| 186 | int start, int end); | - |
| 187 | void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, | - |
| 188 | int sourceStart, int sourceEnd, | - |
| 189 | const QModelIndex &destParent, int dest); | - |
| 190 | void _q_sourceColumnsMoved(const QModelIndex &sourceParent, | - |
| 191 | int sourceStart, int sourceEnd, | - |
| 192 | const QModelIndex &destParent, int dest); | - |
| 193 | | - |
| 194 | void _q_clearMapping(); | - |
| 195 | | - |
| 196 | void sort(); | - |
| 197 | bool update_source_sort_column(); | - |
| 198 | void sort_source_rows(QVector<int> &source_rows, | - |
| 199 | const QModelIndex &source_parent) const; | - |
| 200 | QVector<QPair<int, QVector<int > > > proxy_intervals_for_source_items_to_add( | - |
| 201 | const QVector<int> &proxy_to_source, const QVector<int> &source_items, | - |
| 202 | const QModelIndex &source_parent, Qt::Orientation orient) const; | - |
| 203 | QVector<QPair<int, int > > proxy_intervals_for_source_items( | - |
| 204 | const QVector<int> &source_to_proxy, const QVector<int> &source_items) const; | - |
| 205 | void insert_source_items( | - |
| 206 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 207 | const QVector<int> &source_items, const QModelIndex &source_parent, | - |
| 208 | Qt::Orientation orient, bool emit_signal = true); | - |
| 209 | void remove_source_items( | - |
| 210 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 211 | const QVector<int> &source_items, const QModelIndex &source_parent, | - |
| 212 | Qt::Orientation orient, bool emit_signal = true); | - |
| 213 | void remove_proxy_interval( | - |
| 214 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 215 | int proxy_start, int proxy_end, const QModelIndex &proxy_parent, | - |
| 216 | Qt::Orientation orient, bool emit_signal = true); | - |
| 217 | void build_source_to_proxy_mapping( | - |
| 218 | const QVector<int> &proxy_to_source, QVector<int> &source_to_proxy) const; | - |
| 219 | void source_items_inserted(const QModelIndex &source_parent, | - |
| 220 | int start, int end, Qt::Orientation orient); | - |
| 221 | void source_items_about_to_be_removed(const QModelIndex &source_parent, | - |
| 222 | int start, int end, Qt::Orientation orient); | - |
| 223 | void source_items_removed(const QModelIndex &source_parent, | - |
| 224 | int start, int end, Qt::Orientation orient); | - |
| 225 | void proxy_item_range( | - |
| 226 | const QVector<int> &source_to_proxy, const QVector<int> &source_items, | - |
| 227 | int &proxy_low, int &proxy_high) const; | - |
| 228 | | - |
| 229 | QModelIndexPairList store_persistent_indexes(); | - |
| 230 | void update_persistent_indexes(const QModelIndexPairList &source_indexes); | - |
| 231 | | - |
| 232 | void filter_changed(const QModelIndex &source_parent = QModelIndex()); | - |
| 233 | QSet<int> handle_filter_changed( | - |
| 234 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 235 | const QModelIndex &source_parent, Qt::Orientation orient); | - |
| 236 | | - |
| 237 | void updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping, | - |
| 238 | Qt::Orientation orient, int start, int end, int delta_item_count, bool remove); | - |
| 239 | | - |
| 240 | virtual void _q_sourceModelDestroyed(); | - |
| 241 | }; | - |
| 242 | | - |
| 243 | typedef QHash<QModelIndex, QSortFilterProxyModelPrivate::Mapping *> IndexMap; | - |
| 244 | | - |
| 245 | void QSortFilterProxyModelPrivate::_q_sourceModelDestroyed() | - |
| 246 | { | - |
| 247 | QAbstractProxyModelPrivate::_q_sourceModelDestroyed(); | - |
| 248 | _q_clearMapping(); | - |
| 249 | } executed: }Execution Count:12 | 12 |
| 250 | | - |
| 251 | void QSortFilterProxyModelPrivate::remove_from_mapping(const QModelIndex &source_parent) | - |
| 252 | { | - |
| 253 | if (Mapping *m = source_index_mapping.take(source_parent)) { partially evaluated: Mapping *m = source_index_mapping.take(source_parent)| yes Evaluation Count:38 | no Evaluation Count:0 |
| 0-38 |
| 254 | for (int i = 0; i < m->mapped_children.size(); ++i) evaluated: i < m->mapped_children.size()| yes Evaluation Count:20 | yes Evaluation Count:38 |
| 20-38 |
| 255 | remove_from_mapping(m->mapped_children.at(i)); executed: remove_from_mapping(m->mapped_children.at(i));Execution Count:20 | 20 |
| 256 | delete m; | - |
| 257 | } executed: }Execution Count:38 | 38 |
| 258 | } executed: }Execution Count:38 | 38 |
| 259 | | - |
| 260 | void QSortFilterProxyModelPrivate::_q_clearMapping() | - |
| 261 | { | - |
| 262 | | - |
| 263 | QModelIndexPairList source_indexes = store_persistent_indexes(); | - |
| 264 | | - |
| 265 | qDeleteAll(source_index_mapping); | - |
| 266 | source_index_mapping.clear(); | - |
| 267 | if (dynamic_sortfilter && update_source_sort_column()) { evaluated: dynamic_sortfilter| yes Evaluation Count:776 | yes Evaluation Count:6 |
evaluated: update_source_sort_column()| yes Evaluation Count:12 | yes Evaluation Count:764 |
| 6-776 |
| 268 | | - |
| 269 | qDeleteAll(source_index_mapping); | - |
| 270 | source_index_mapping.clear(); | - |
| 271 | } executed: }Execution Count:12 | 12 |
| 272 | | - |
| 273 | | - |
| 274 | update_persistent_indexes(source_indexes); | - |
| 275 | } executed: }Execution Count:782 | 782 |
| 276 | | - |
| 277 | IndexMap::const_iterator QSortFilterProxyModelPrivate::create_mapping( | - |
| 278 | const QModelIndex &source_parent) const | - |
| 279 | { | - |
| 280 | const QSortFilterProxyModel * const q = q_func(); | - |
| 281 | | - |
| 282 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 283 | if (it != source_index_mapping.constEnd()) evaluated: it != source_index_mapping.constEnd()| yes Evaluation Count:146436 | yes Evaluation Count:1173 |
| 1173-146436 |
| 284 | return it; executed: return it;Execution Count:146436 | 146436 |
| 285 | | - |
| 286 | Mapping *m = new Mapping; | - |
| 287 | | - |
| 288 | int source_rows = model->rowCount(source_parent); | - |
| 289 | m->source_rows.reserve(source_rows); | - |
| 290 | for (int i = 0; i < source_rows; ++i) { evaluated: i < source_rows| yes Evaluation Count:11362 | yes Evaluation Count:1173 |
| 1173-11362 |
| 291 | if (q->filterAcceptsRow(i, source_parent)) evaluated: q->filterAcceptsRow(i, source_parent)| yes Evaluation Count:4731 | yes Evaluation Count:6631 |
| 4731-6631 |
| 292 | m->source_rows.append(i); executed: m->source_rows.append(i);Execution Count:4731 | 4731 |
| 293 | } executed: }Execution Count:11362 | 11362 |
| 294 | int source_cols = model->columnCount(source_parent); | - |
| 295 | m->source_columns.reserve(source_cols); | - |
| 296 | for (int i = 0; i < source_cols; ++i) { evaluated: i < source_cols| yes Evaluation Count:235 | yes Evaluation Count:1173 |
| 235-1173 |
| 297 | if (q->filterAcceptsColumn(i, source_parent)) partially evaluated: q->filterAcceptsColumn(i, source_parent)| yes Evaluation Count:235 | no Evaluation Count:0 |
| 0-235 |
| 298 | m->source_columns.append(i); executed: m->source_columns.append(i);Execution Count:235 | 235 |
| 299 | } executed: }Execution Count:235 | 235 |
| 300 | | - |
| 301 | sort_source_rows(m->source_rows, source_parent); | - |
| 302 | m->proxy_rows.resize(source_rows); | - |
| 303 | build_source_to_proxy_mapping(m->source_rows, m->proxy_rows); | - |
| 304 | m->proxy_columns.resize(source_cols); | - |
| 305 | build_source_to_proxy_mapping(m->source_columns, m->proxy_columns); | - |
| 306 | | - |
| 307 | it = IndexMap::const_iterator(source_index_mapping.insert(source_parent, m)); | - |
| 308 | m->map_iter = it; | - |
| 309 | | - |
| 310 | if (source_parent.isValid()) { evaluated: source_parent.isValid()| yes Evaluation Count:763 | yes Evaluation Count:410 |
| 410-763 |
| 311 | QModelIndex source_grand_parent = source_parent.parent(); | - |
| 312 | IndexMap::const_iterator it2 = create_mapping(source_grand_parent); | - |
| 313 | qt_noop(); | - |
| 314 | it2.value()->mapped_children.append(source_parent); | - |
| 315 | } executed: }Execution Count:763 | 763 |
| 316 | | - |
| 317 | qt_noop(); | - |
| 318 | qt_noop(); | - |
| 319 | | - |
| 320 | return it; executed: return it;Execution Count:1173 | 1173 |
| 321 | } | - |
| 322 | | - |
| 323 | QModelIndex QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex &proxy_index) const | - |
| 324 | { | - |
| 325 | if (!proxy_index.isValid()) evaluated: !proxy_index.isValid()| yes Evaluation Count:99785 | yes Evaluation Count:98443 |
| 98443-99785 |
| 326 | return QModelIndex(); executed: return QModelIndex();Execution Count:99785 | 99785 |
| 327 | if (proxy_index.model() != q_func()) { evaluated: proxy_index.model() != q_func()| yes Evaluation Count:1 | yes Evaluation Count:98442 |
| 1-98442 |
| 328 | QMessageLogger("itemmodels/qsortfilterproxymodel.cpp", 378, __PRETTY_FUNCTION__).warning() << "QSortFilterProxyModel: index from wrong model passed to mapToSource"; | - |
| 329 | qt_noop(); | - |
| 330 | return QModelIndex(); executed: return QModelIndex();Execution Count:1 | 1 |
| 331 | } | - |
| 332 | IndexMap::const_iterator it = index_to_iterator(proxy_index); | - |
| 333 | Mapping *m = it.value(); | - |
| 334 | if ((proxy_index.row() >= m->source_rows.size()) || (proxy_index.column() >= m->source_columns.size())) partially evaluated: (proxy_index.row() >= m->source_rows.size())| no Evaluation Count:0 | yes Evaluation Count:98442 |
partially evaluated: (proxy_index.column() >= m->source_columns.size())| no Evaluation Count:0 | yes Evaluation Count:98442 |
| 0-98442 |
| 335 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
| 336 | int source_row = m->source_rows.at(proxy_index.row()); | - |
| 337 | int source_col = m->source_columns.at(proxy_index.column()); | - |
| 338 | return model->index(source_row, source_col, it.key()); executed: return model->index(source_row, source_col, it.key());Execution Count:98442 | 98442 |
| 339 | } | - |
| 340 | | - |
| 341 | QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &source_index) const | - |
| 342 | { | - |
| 343 | if (!source_index.isValid()) evaluated: !source_index.isValid()| yes Evaluation Count:11762 | yes Evaluation Count:7279 |
| 7279-11762 |
| 344 | return QModelIndex(); executed: return QModelIndex();Execution Count:11762 | 11762 |
| 345 | if (source_index.model() != model) { evaluated: source_index.model() != model| yes Evaluation Count:1 | yes Evaluation Count:7278 |
| 1-7278 |
| 346 | QMessageLogger("itemmodels/qsortfilterproxymodel.cpp", 396, __PRETTY_FUNCTION__).warning() << "QSortFilterProxyModel: index from wrong model passed to mapFromSource"; | - |
| 347 | qt_noop(); | - |
| 348 | return QModelIndex(); executed: return QModelIndex();Execution Count:1 | 1 |
| 349 | } | - |
| 350 | QModelIndex source_parent = source_index.parent(); | - |
| 351 | IndexMap::const_iterator it = create_mapping(source_parent); | - |
| 352 | Mapping *m = it.value(); | - |
| 353 | if ((source_index.row() >= m->proxy_rows.size()) || (source_index.column() >= m->proxy_columns.size())) partially evaluated: (source_index.row() >= m->proxy_rows.size())| no Evaluation Count:0 | yes Evaluation Count:7278 |
partially evaluated: (source_index.column() >= m->proxy_columns.size())| no Evaluation Count:0 | yes Evaluation Count:7278 |
| 0-7278 |
| 354 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
| 355 | int proxy_row = m->proxy_rows.at(source_index.row()); | - |
| 356 | int proxy_column = m->proxy_columns.at(source_index.column()); | - |
| 357 | if (proxy_row == -1 || proxy_column == -1) evaluated: proxy_row == -1| yes Evaluation Count:8 | yes Evaluation Count:7270 |
partially evaluated: proxy_column == -1| no Evaluation Count:0 | yes Evaluation Count:7270 |
| 0-7270 |
| 358 | return QModelIndex(); executed: return QModelIndex();Execution Count:8 | 8 |
| 359 | return create_index(proxy_row, proxy_column, it); executed: return create_index(proxy_row, proxy_column, it);Execution Count:7270 | 7270 |
| 360 | } | - |
| 361 | | - |
| 362 | bool QSortFilterProxyModelPrivate::can_create_mapping(const QModelIndex &source_parent) const | - |
| 363 | { | - |
| 364 | if (source_parent.isValid()) { evaluated: source_parent.isValid()| yes Evaluation Count:1672 | yes Evaluation Count:590 |
| 590-1672 |
| 365 | QModelIndex source_grand_parent = source_parent.parent(); | - |
| 366 | IndexMap::const_iterator it = source_index_mapping.constFind(source_grand_parent); | - |
| 367 | if (it == source_index_mapping.constEnd()) { partially evaluated: it == source_index_mapping.constEnd()| no Evaluation Count:0 | yes Evaluation Count:1672 |
| 0-1672 |
| 368 | | - |
| 369 | return false; never executed: return false; | 0 |
| 370 | } | - |
| 371 | Mapping *gm = it.value(); | - |
| 372 | if (gm->proxy_rows.at(source_parent.row()) == -1 || evaluated: gm->proxy_rows.at(source_parent.row()) == -1| yes Evaluation Count:4 | yes Evaluation Count:1668 |
| 4-1668 |
| 373 | gm->proxy_columns.at(source_parent.column()) == -1) { partially evaluated: gm->proxy_columns.at(source_parent.column()) == -1| no Evaluation Count:0 | yes Evaluation Count:1668 |
| 0-1668 |
| 374 | | - |
| 375 | return false; executed: return false;Execution Count:4 | 4 |
| 376 | } | - |
| 377 | } executed: }Execution Count:1668 | 1668 |
| 378 | return true; executed: return true;Execution Count:2258 | 2258 |
| 379 | } | - |
| 380 | | - |
| 381 | | - |
| 382 | | - |
| 383 | | - |
| 384 | | - |
| 385 | | - |
| 386 | void QSortFilterProxyModelPrivate::sort() | - |
| 387 | { | - |
| 388 | QSortFilterProxyModel * const q = q_func(); | - |
| 389 | q->layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint); | - |
| 390 | QModelIndexPairList source_indexes = store_persistent_indexes(); | - |
| 391 | IndexMap::const_iterator it = source_index_mapping.constBegin(); | - |
| 392 | for (; it != source_index_mapping.constEnd(); ++it) { evaluated: it != source_index_mapping.constEnd()| yes Evaluation Count:255 | yes Evaluation Count:230 |
| 230-255 |
| 393 | QModelIndex source_parent = it.key(); | - |
| 394 | Mapping *m = it.value(); | - |
| 395 | sort_source_rows(m->source_rows, source_parent); | - |
| 396 | build_source_to_proxy_mapping(m->source_rows, m->proxy_rows); | - |
| 397 | } executed: }Execution Count:255 | 255 |
| 398 | update_persistent_indexes(source_indexes); | - |
| 399 | q->layoutChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::VerticalSortHint); | - |
| 400 | } executed: }Execution Count:230 | 230 |
| 401 | | - |
| 402 | | - |
| 403 | | - |
| 404 | | - |
| 405 | | - |
| 406 | | - |
| 407 | | - |
| 408 | bool QSortFilterProxyModelPrivate::update_source_sort_column() | - |
| 409 | { | - |
| 410 | QSortFilterProxyModel * const q = q_func(); | - |
| 411 | QModelIndex proxy_index = q->index(0, proxy_sort_column, QModelIndex()); | - |
| 412 | int old_source_sort_column = source_sort_column; | - |
| 413 | source_sort_column = q->mapToSource(proxy_index).column(); | - |
| 414 | return old_source_sort_column != source_sort_column; executed: return old_source_sort_column != source_sort_column;Execution Count:2689 | 2689 |
| 415 | } | - |
| 416 | | - |
| 417 | | - |
| 418 | | - |
| 419 | | - |
| 420 | | - |
| 421 | | - |
| 422 | | - |
| 423 | void QSortFilterProxyModelPrivate::sort_source_rows( | - |
| 424 | QVector<int> &source_rows, const QModelIndex &source_parent) const | - |
| 425 | { | - |
| 426 | const QSortFilterProxyModel * const q = q_func(); | - |
| 427 | if (source_sort_column >= 0) { evaluated: source_sort_column >= 0| yes Evaluation Count:253 | yes Evaluation Count:2354 |
| 253-2354 |
| 428 | if (sort_order == Qt::AscendingOrder) { evaluated: sort_order == Qt::AscendingOrder| yes Evaluation Count:234 | yes Evaluation Count:19 |
| 19-234 |
| 429 | QSortFilterProxyModelLessThan lt(source_sort_column, source_parent, model, q); | - |
| 430 | std::stable_sort(source_rows.begin(), source_rows.end(), lt); | - |
| 431 | } else { executed: }Execution Count:234 | 234 |
| 432 | QSortFilterProxyModelGreaterThan gt(source_sort_column, source_parent, model, q); | - |
| 433 | std::stable_sort(source_rows.begin(), source_rows.end(), gt); | - |
| 434 | } executed: }Execution Count:19 | 19 |
| 435 | } else { | - |
| 436 | std::stable_sort(source_rows.begin(), source_rows.end()); | - |
| 437 | } executed: }Execution Count:2354 | 2354 |
| 438 | } | - |
| 439 | QVector<QPair<int, int > > QSortFilterProxyModelPrivate::proxy_intervals_for_source_items( | - |
| 440 | const QVector<int> &source_to_proxy, const QVector<int> &source_items) const | - |
| 441 | { | - |
| 442 | QVector<QPair<int, int> > proxy_intervals; | - |
| 443 | if (source_items.isEmpty()) evaluated: source_items.isEmpty()| yes Evaluation Count:10 | yes Evaluation Count:119 |
| 10-119 |
| 444 | return proxy_intervals; executed: return proxy_intervals;Execution Count:10 | 10 |
| 445 | | - |
| 446 | int source_items_index = 0; | - |
| 447 | while (source_items_index < source_items.size()) { evaluated: source_items_index < source_items.size()| yes Evaluation Count:139 | yes Evaluation Count:119 |
| 119-139 |
| 448 | int first_proxy_item = source_to_proxy.at(source_items.at(source_items_index)); | - |
| 449 | qt_noop(); | - |
| 450 | int last_proxy_item = first_proxy_item; | - |
| 451 | ++source_items_index; | - |
| 452 | | - |
| 453 | while ((source_items_index < source_items.size()) evaluated: (source_items_index < source_items.size())| yes Evaluation Count:484 | yes Evaluation Count:119 |
| 119-484 |
| 454 | && (source_to_proxy.at(source_items.at(source_items_index)) == last_proxy_item + 1)) { evaluated: (source_to_proxy.at(source_items.at(source_items_index)) == last_proxy_item + 1)| yes Evaluation Count:464 | yes Evaluation Count:20 |
| 20-464 |
| 455 | ++last_proxy_item; | - |
| 456 | ++source_items_index; | - |
| 457 | } executed: }Execution Count:464 | 464 |
| 458 | | - |
| 459 | proxy_intervals.append(QPair<int, int>(first_proxy_item, last_proxy_item)); | - |
| 460 | } executed: }Execution Count:139 | 139 |
| 461 | std::stable_sort(proxy_intervals.begin(), proxy_intervals.end()); | - |
| 462 | return proxy_intervals; executed: return proxy_intervals;Execution Count:119 | 119 |
| 463 | } | - |
| 464 | void QSortFilterProxyModelPrivate::remove_source_items( | - |
| 465 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 466 | const QVector<int> &source_items, const QModelIndex &source_parent, | - |
| 467 | Qt::Orientation orient, bool emit_signal) | - |
| 468 | { | - |
| 469 | QSortFilterProxyModel * const q = q_func(); | - |
| 470 | QModelIndex proxy_parent = q->mapFromSource(source_parent); | - |
| 471 | if (!proxy_parent.isValid() && source_parent.isValid()) evaluated: !proxy_parent.isValid()| yes Evaluation Count:71 | yes Evaluation Count:58 |
partially evaluated: source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:71 |
| 0-71 |
| 472 | return; | 0 |
| 473 | | - |
| 474 | QVector<QPair<int, int> > proxy_intervals; | - |
| 475 | proxy_intervals = proxy_intervals_for_source_items(source_to_proxy, source_items); | - |
| 476 | | - |
| 477 | for (int i = proxy_intervals.size()-1; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:139 | yes Evaluation Count:129 |
| 129-139 |
| 478 | QPair<int, int> interval = proxy_intervals.at(i); | - |
| 479 | int proxy_start = interval.first; | - |
| 480 | int proxy_end = interval.second; | - |
| 481 | remove_proxy_interval(source_to_proxy, proxy_to_source, proxy_start, proxy_end, | - |
| 482 | proxy_parent, orient, emit_signal); | - |
| 483 | } executed: }Execution Count:139 | 139 |
| 484 | } executed: }Execution Count:129 | 129 |
| 485 | void QSortFilterProxyModelPrivate::remove_proxy_interval( | - |
| 486 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, int proxy_start, int proxy_end, | - |
| 487 | const QModelIndex &proxy_parent, Qt::Orientation orient, bool emit_signal) | - |
| 488 | { | - |
| 489 | QSortFilterProxyModel * const q = q_func(); | - |
| 490 | if (emit_signal) { evaluated: emit_signal| yes Evaluation Count:134 | yes Evaluation Count:5 |
| 5-134 |
| 491 | if (orient == Qt::Vertical) evaluated: orient == Qt::Vertical| yes Evaluation Count:99 | yes Evaluation Count:35 |
| 35-99 |
| 492 | q->beginRemoveRows(proxy_parent, proxy_start, proxy_end); executed: q->beginRemoveRows(proxy_parent, proxy_start, proxy_end);Execution Count:99 | 99 |
| 493 | else | - |
| 494 | q->beginRemoveColumns(proxy_parent, proxy_start, proxy_end); executed: q->beginRemoveColumns(proxy_parent, proxy_start, proxy_end);Execution Count:35 | 35 |
| 495 | } | - |
| 496 | | - |
| 497 | | - |
| 498 | proxy_to_source.remove(proxy_start, proxy_end - proxy_start + 1); | - |
| 499 | | - |
| 500 | build_source_to_proxy_mapping(proxy_to_source, source_to_proxy); | - |
| 501 | | - |
| 502 | if (emit_signal) { evaluated: emit_signal| yes Evaluation Count:134 | yes Evaluation Count:5 |
| 5-134 |
| 503 | if (orient == Qt::Vertical) evaluated: orient == Qt::Vertical| yes Evaluation Count:99 | yes Evaluation Count:35 |
| 35-99 |
| 504 | q->endRemoveRows(); executed: q->endRemoveRows();Execution Count:99 | 99 |
| 505 | else | - |
| 506 | q->endRemoveColumns(); executed: q->endRemoveColumns();Execution Count:35 | 35 |
| 507 | } | - |
| 508 | } executed: }Execution Count:139 | 139 |
| 509 | QVector<QPair<int, QVector<int > > > QSortFilterProxyModelPrivate::proxy_intervals_for_source_items_to_add( | - |
| 510 | const QVector<int> &proxy_to_source, const QVector<int> &source_items, | - |
| 511 | const QModelIndex &source_parent, Qt::Orientation orient) const | - |
| 512 | { | - |
| 513 | const QSortFilterProxyModel * const q = q_func(); | - |
| 514 | QVector<QPair<int, QVector<int> > > proxy_intervals; | - |
| 515 | if (source_items.isEmpty()) evaluated: source_items.isEmpty()| yes Evaluation Count:35 | yes Evaluation Count:2276 |
| 35-2276 |
| 516 | return proxy_intervals; executed: return proxy_intervals;Execution Count:35 | 35 |
| 517 | | - |
| 518 | int proxy_low = 0; | - |
| 519 | int proxy_item = 0; | - |
| 520 | int source_items_index = 0; | - |
| 521 | QVector<int> source_items_in_interval; | - |
| 522 | bool compare = (orient == Qt::Vertical && source_sort_column >= 0 && dynamic_sortfilter); evaluated: orient == Qt::Vertical| yes Evaluation Count:1144 | yes Evaluation Count:1132 |
evaluated: source_sort_column >= 0| yes Evaluation Count:12 | yes Evaluation Count:1132 |
evaluated: dynamic_sortfilter| yes Evaluation Count:11 | yes Evaluation Count:1 |
| 1-1144 |
| 523 | while (source_items_index < source_items.size()) { evaluated: source_items_index < source_items.size()| yes Evaluation Count:2286 | yes Evaluation Count:2276 |
| 2276-2286 |
| 524 | source_items_in_interval.clear(); | - |
| 525 | int first_new_source_item = source_items.at(source_items_index); | - |
| 526 | source_items_in_interval.append(first_new_source_item); | - |
| 527 | ++source_items_index; | - |
| 528 | | - |
| 529 | | - |
| 530 | int proxy_high = proxy_to_source.size() - 1; | - |
| 531 | QModelIndex i1 = compare ? model->index(first_new_source_item, source_sort_column, source_parent) : QModelIndex(); evaluated: compare| yes Evaluation Count:13 | yes Evaluation Count:2273 |
| 13-2273 |
| 532 | while (proxy_low <= proxy_high) { evaluated: proxy_low <= proxy_high| yes Evaluation Count:1152 | yes Evaluation Count:2286 |
| 1152-2286 |
| 533 | proxy_item = (proxy_low + proxy_high) / 2; | - |
| 534 | if (compare) { evaluated: compare| yes Evaluation Count:19 | yes Evaluation Count:1133 |
| 19-1133 |
| 535 | QModelIndex i2 = model->index(proxy_to_source.at(proxy_item), source_sort_column, source_parent); | - |
| 536 | if ((sort_order == Qt::AscendingOrder) ? q->lessThan(i1, i2) : q->lessThan(i2, i1)) evaluated: (sort_order == Qt::AscendingOrder)| yes Evaluation Count:13 | yes Evaluation Count:6 |
| 6-13 |
| 537 | proxy_high = proxy_item - 1; executed: proxy_high = proxy_item - 1;Execution Count:4 | 4 |
| 538 | else | - |
| 539 | proxy_low = proxy_item + 1; executed: proxy_low = proxy_item + 1;Execution Count:15 | 15 |
| 540 | } else { | - |
| 541 | if (first_new_source_item < proxy_to_source.at(proxy_item)) evaluated: first_new_source_item < proxy_to_source.at(proxy_item)| yes Evaluation Count:882 | yes Evaluation Count:251 |
| 251-882 |
| 542 | proxy_high = proxy_item - 1; executed: proxy_high = proxy_item - 1;Execution Count:882 | 882 |
| 543 | else | - |
| 544 | proxy_low = proxy_item + 1; executed: proxy_low = proxy_item + 1;Execution Count:251 | 251 |
| 545 | } | - |
| 546 | } | - |
| 547 | proxy_item = proxy_low; | - |
| 548 | | - |
| 549 | | - |
| 550 | if (proxy_item >= proxy_to_source.size()) { evaluated: proxy_item >= proxy_to_source.size()| yes Evaluation Count:2042 | yes Evaluation Count:244 |
| 244-2042 |
| 551 | for ( ; source_items_index < source_items.size(); ++source_items_index) evaluated: source_items_index < source_items.size()| yes Evaluation Count:55105 | yes Evaluation Count:2042 |
| 2042-55105 |
| 552 | source_items_in_interval.append(source_items.at(source_items_index)); executed: source_items_in_interval.append(source_items.at(source_items_index));Execution Count:55105 | 55105 |
| 553 | } else { executed: }Execution Count:2042 | 2042 |
| 554 | i1 = compare ? model->index(proxy_to_source.at(proxy_item), source_sort_column, source_parent) : QModelIndex(); evaluated: compare| yes Evaluation Count:4 | yes Evaluation Count:240 |
| 4-240 |
| 555 | for ( ; source_items_index < source_items.size(); ++source_items_index) { evaluated: source_items_index < source_items.size()| yes Evaluation Count:4828 | yes Evaluation Count:234 |
| 234-4828 |
| 556 | int new_source_item = source_items.at(source_items_index); | - |
| 557 | if (compare) { evaluated: compare| yes Evaluation Count:2 | yes Evaluation Count:4826 |
| 2-4826 |
| 558 | QModelIndex i2 = model->index(new_source_item, source_sort_column, source_parent); | - |
| 559 | if ((sort_order == Qt::AscendingOrder) ? q->lessThan(i1, i2) : q->lessThan(i2, i1)) partially evaluated: (sort_order == Qt::AscendingOrder)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 560 | break; executed: break;Execution Count:2 | 2 |
| 561 | } else { | 0 |
| 562 | if (proxy_to_source.at(proxy_item) < new_source_item) evaluated: proxy_to_source.at(proxy_item) < new_source_item| yes Evaluation Count:8 | yes Evaluation Count:4818 |
| 8-4818 |
| 563 | break; executed: break;Execution Count:8 | 8 |
| 564 | } executed: }Execution Count:4818 | 4818 |
| 565 | source_items_in_interval.append(new_source_item); | - |
| 566 | } executed: }Execution Count:4818 | 4818 |
| 567 | } executed: }Execution Count:244 | 244 |
| 568 | | - |
| 569 | | - |
| 570 | proxy_intervals.append(QPair<int, QVector<int> >(proxy_item, source_items_in_interval)); | - |
| 571 | } executed: }Execution Count:2286 | 2286 |
| 572 | return proxy_intervals; executed: return proxy_intervals;Execution Count:2276 | 2276 |
| 573 | } | - |
| 574 | void QSortFilterProxyModelPrivate::insert_source_items( | - |
| 575 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 576 | const QVector<int> &source_items, const QModelIndex &source_parent, | - |
| 577 | Qt::Orientation orient, bool emit_signal) | - |
| 578 | { | - |
| 579 | QSortFilterProxyModel * const q = q_func(); | - |
| 580 | QModelIndex proxy_parent = q->mapFromSource(source_parent); | - |
| 581 | if (!proxy_parent.isValid() && source_parent.isValid()) evaluated: !proxy_parent.isValid()| yes Evaluation Count:631 | yes Evaluation Count:1680 |
partially evaluated: source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:631 |
| 0-1680 |
| 582 | return; | 0 |
| 583 | | - |
| 584 | QVector<QPair<int, QVector<int> > > proxy_intervals; | - |
| 585 | proxy_intervals = proxy_intervals_for_source_items_to_add( | - |
| 586 | proxy_to_source, source_items, source_parent, orient); | - |
| 587 | | - |
| 588 | for (int i = proxy_intervals.size()-1; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:2286 | yes Evaluation Count:2311 |
| 2286-2311 |
| 589 | QPair<int, QVector<int> > interval = proxy_intervals.at(i); | - |
| 590 | int proxy_start = interval.first; | - |
| 591 | QVector<int> source_items = interval.second; | - |
| 592 | int proxy_end = proxy_start + source_items.size() - 1; | - |
| 593 | | - |
| 594 | if (emit_signal) { evaluated: emit_signal| yes Evaluation Count:2281 | yes Evaluation Count:5 |
| 5-2281 |
| 595 | if (orient == Qt::Vertical) evaluated: orient == Qt::Vertical| yes Evaluation Count:1149 | yes Evaluation Count:1132 |
| 1132-1149 |
| 596 | q->beginInsertRows(proxy_parent, proxy_start, proxy_end); executed: q->beginInsertRows(proxy_parent, proxy_start, proxy_end);Execution Count:1149 | 1149 |
| 597 | else | - |
| 598 | q->beginInsertColumns(proxy_parent, proxy_start, proxy_end); executed: q->beginInsertColumns(proxy_parent, proxy_start, proxy_end);Execution Count:1132 | 1132 |
| 599 | } | - |
| 600 | | - |
| 601 | for (int i = 0; i < source_items.size(); ++i) evaluated: i < source_items.size()| yes Evaluation Count:62209 | yes Evaluation Count:2286 |
| 2286-62209 |
| 602 | proxy_to_source.insert(proxy_start + i, source_items.at(i)); executed: proxy_to_source.insert(proxy_start + i, source_items.at(i));Execution Count:62209 | 62209 |
| 603 | | - |
| 604 | build_source_to_proxy_mapping(proxy_to_source, source_to_proxy); | - |
| 605 | | - |
| 606 | if (emit_signal) { evaluated: emit_signal| yes Evaluation Count:2281 | yes Evaluation Count:5 |
| 5-2281 |
| 607 | if (orient == Qt::Vertical) evaluated: orient == Qt::Vertical| yes Evaluation Count:1149 | yes Evaluation Count:1132 |
| 1132-1149 |
| 608 | q->endInsertRows(); executed: q->endInsertRows();Execution Count:1149 | 1149 |
| 609 | else | - |
| 610 | q->endInsertColumns(); executed: q->endInsertColumns();Execution Count:1132 | 1132 |
| 611 | } | - |
| 612 | } executed: }Execution Count:2286 | 2286 |
| 613 | } executed: }Execution Count:2311 | 2311 |
| 614 | void QSortFilterProxyModelPrivate::source_items_inserted( | - |
| 615 | const QModelIndex &source_parent, int start, int end, Qt::Orientation orient) | - |
| 616 | { | - |
| 617 | QSortFilterProxyModel * const q = q_func(); | - |
| 618 | if ((start < 0) || (end < 0)) partially evaluated: (start < 0)| no Evaluation Count:0 | yes Evaluation Count:2260 |
partially evaluated: (end < 0)| no Evaluation Count:0 | yes Evaluation Count:2260 |
| 0-2260 |
| 619 | return; | 0 |
| 620 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 621 | if (it == source_index_mapping.constEnd()) { evaluated: it == source_index_mapping.constEnd()| yes Evaluation Count:2 | yes Evaluation Count:2258 |
| 2-2258 |
| 622 | if (!can_create_mapping(source_parent)) partially evaluated: !can_create_mapping(source_parent)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 623 | return; executed: return;Execution Count:2 | 2 |
| 624 | it = create_mapping(source_parent); | - |
| 625 | Mapping *m = it.value(); | - |
| 626 | QModelIndex proxy_parent = q->mapFromSource(source_parent); | - |
| 627 | if (m->source_rows.count() > 0) { never evaluated: m->source_rows.count() > 0 | 0 |
| 628 | q->beginInsertRows(proxy_parent, 0, m->source_rows.count() - 1); | - |
| 629 | q->endInsertRows(); | - |
| 630 | } | 0 |
| 631 | if (m->source_columns.count() > 0) { never evaluated: m->source_columns.count() > 0 | 0 |
| 632 | q->beginInsertColumns(proxy_parent, 0, m->source_columns.count() - 1); | - |
| 633 | q->endInsertColumns(); | - |
| 634 | } | 0 |
| 635 | return; | 0 |
| 636 | } | - |
| 637 | | - |
| 638 | Mapping *m = it.value(); | - |
| 639 | QVector<int> &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:1126 | yes Evaluation Count:1132 |
| 1126-1132 |
| 640 | QVector<int> &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:1126 | yes Evaluation Count:1132 |
| 1126-1132 |
| 641 | | - |
| 642 | int delta_item_count = end - start + 1; | - |
| 643 | int old_item_count = source_to_proxy.size(); | - |
| 644 | | - |
| 645 | updateChildrenMapping(source_parent, m, orient, start, end, delta_item_count, false); | - |
| 646 | | - |
| 647 | | - |
| 648 | if (start < 0 || start > source_to_proxy.size()) { partially evaluated: start < 0| no Evaluation Count:0 | yes Evaluation Count:2258 |
partially evaluated: start > source_to_proxy.size()| no Evaluation Count:0 | yes Evaluation Count:2258 |
| 0-2258 |
| 649 | QMessageLogger("itemmodels/qsortfilterproxymodel.cpp", 763, __PRETTY_FUNCTION__).warning("QSortFilterProxyModel: invalid inserted rows reported by source model"); | - |
| 650 | remove_from_mapping(source_parent); | - |
| 651 | return; | 0 |
| 652 | } | - |
| 653 | source_to_proxy.insert(start, delta_item_count, -1); | - |
| 654 | | - |
| 655 | if (start < old_item_count) { evaluated: start < old_item_count| yes Evaluation Count:231 | yes Evaluation Count:2027 |
| 231-2027 |
| 656 | | - |
| 657 | int proxy_count = proxy_to_source.size(); | - |
| 658 | for (int proxy_item = 0; proxy_item < proxy_count; ++proxy_item) { evaluated: proxy_item < proxy_count| yes Evaluation Count:6691 | yes Evaluation Count:231 |
| 231-6691 |
| 659 | int source_item = proxy_to_source.at(proxy_item); | - |
| 660 | if (source_item >= start) evaluated: source_item >= start| yes Evaluation Count:6124 | yes Evaluation Count:567 |
| 567-6124 |
| 661 | proxy_to_source.replace(proxy_item, source_item + delta_item_count); executed: proxy_to_source.replace(proxy_item, source_item + delta_item_count);Execution Count:6124 | 6124 |
| 662 | } executed: }Execution Count:6691 | 6691 |
| 663 | build_source_to_proxy_mapping(proxy_to_source, source_to_proxy); | - |
| 664 | } executed: }Execution Count:231 | 231 |
| 665 | | - |
| 666 | | - |
| 667 | QVector<int> source_items; | - |
| 668 | for (int i = start; i <= end; ++i) { evaluated: i <= end| yes Evaluation Count:62177 | yes Evaluation Count:2258 |
| 2258-62177 |
| 669 | if ((orient == Qt::Vertical) evaluated: (orient == Qt::Vertical)| yes Evaluation Count:36285 | yes Evaluation Count:25892 |
| 25892-36285 |
| 670 | ? q->filterAcceptsRow(i, source_parent) | - |
| 671 | : q->filterAcceptsColumn(i, source_parent)) { | - |
| 672 | source_items.append(i); | - |
| 673 | } executed: }Execution Count:62167 | 62167 |
| 674 | } executed: }Execution Count:62177 | 62177 |
| 675 | | - |
| 676 | if (model->rowCount(source_parent) == delta_item_count) { evaluated: model->rowCount(source_parent) == delta_item_count| yes Evaluation Count:1765 | yes Evaluation Count:493 |
| 493-1765 |
| 677 | | - |
| 678 | | - |
| 679 | | - |
| 680 | | - |
| 681 | QVector<int> &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns; evaluated: (orient == Qt::Horizontal)| yes Evaluation Count:836 | yes Evaluation Count:929 |
| 836-929 |
| 682 | QVector<int> &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns; evaluated: (orient == Qt::Horizontal)| yes Evaluation Count:836 | yes Evaluation Count:929 |
| 836-929 |
| 683 | | - |
| 684 | if (orthogonal_source_to_proxy.isEmpty()) { evaluated: orthogonal_source_to_proxy.isEmpty()| yes Evaluation Count:843 | yes Evaluation Count:922 |
| 843-922 |
| 685 | const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent); partially evaluated: (orient == Qt::Horizontal)| no Evaluation Count:0 | yes Evaluation Count:843 |
| 0-843 |
| 686 | | - |
| 687 | orthogonal_source_to_proxy.resize(ortho_end); | - |
| 688 | | - |
| 689 | for (int ortho_item = 0; ortho_item < ortho_end; ++ortho_item) { evaluated: ortho_item < ortho_end| yes Evaluation Count:12 | yes Evaluation Count:843 |
| 12-843 |
| 690 | if ((orient == Qt::Horizontal) ? q->filterAcceptsRow(ortho_item, source_parent) partially evaluated: (orient == Qt::Horizontal)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 691 | : q->filterAcceptsColumn(ortho_item, source_parent)) { | - |
| 692 | orthogonal_proxy_to_source.append(ortho_item); | - |
| 693 | } executed: }Execution Count:11 | 11 |
| 694 | } executed: }Execution Count:12 | 12 |
| 695 | if (orient == Qt::Horizontal) { partially evaluated: orient == Qt::Horizontal| no Evaluation Count:0 | yes Evaluation Count:843 |
| 0-843 |
| 696 | | - |
| 697 | sort_source_rows(orthogonal_proxy_to_source, source_parent); | - |
| 698 | } | 0 |
| 699 | build_source_to_proxy_mapping(orthogonal_proxy_to_source, orthogonal_source_to_proxy); | - |
| 700 | } executed: }Execution Count:843 | 843 |
| 701 | } executed: }Execution Count:1765 | 1765 |
| 702 | | - |
| 703 | | - |
| 704 | if (orient == Qt::Vertical) evaluated: orient == Qt::Vertical| yes Evaluation Count:1126 | yes Evaluation Count:1132 |
| 1126-1132 |
| 705 | sort_source_rows(source_items, source_parent); executed: sort_source_rows(source_items, source_parent);Execution Count:1126 | 1126 |
| 706 | insert_source_items(source_to_proxy, proxy_to_source, source_items, source_parent, orient); | - |
| 707 | } executed: }Execution Count:2258 | 2258 |
| 708 | | - |
| 709 | | - |
| 710 | | - |
| 711 | | - |
| 712 | | - |
| 713 | | - |
| 714 | | - |
| 715 | void QSortFilterProxyModelPrivate::source_items_about_to_be_removed( | - |
| 716 | const QModelIndex &source_parent, int start, int end, Qt::Orientation orient) | - |
| 717 | { | - |
| 718 | if ((start < 0) || (end < 0)) partially evaluated: (start < 0)| no Evaluation Count:0 | yes Evaluation Count:80 |
partially evaluated: (end < 0)| no Evaluation Count:0 | yes Evaluation Count:80 |
| 0-80 |
| 719 | return; | 0 |
| 720 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 721 | if (it == source_index_mapping.constEnd()) { evaluated: it == source_index_mapping.constEnd()| yes Evaluation Count:2 | yes Evaluation Count:78 |
| 2-78 |
| 722 | | - |
| 723 | return; executed: return;Execution Count:2 | 2 |
| 724 | } | - |
| 725 | | - |
| 726 | Mapping *m = it.value(); | - |
| 727 | QVector<int> &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:43 | yes Evaluation Count:35 |
| 35-43 |
| 728 | QVector<int> &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:43 | yes Evaluation Count:35 |
| 35-43 |
| 729 | | - |
| 730 | | - |
| 731 | QVector<int> source_items_to_remove; | - |
| 732 | int proxy_count = proxy_to_source.size(); | - |
| 733 | for (int proxy_item = 0; proxy_item < proxy_count; ++proxy_item) { evaluated: proxy_item < proxy_count| yes Evaluation Count:2053 | yes Evaluation Count:78 |
| 78-2053 |
| 734 | int source_item = proxy_to_source.at(proxy_item); | - |
| 735 | if ((source_item >= start) && (source_item <= end)) evaluated: (source_item >= start)| yes Evaluation Count:1446 | yes Evaluation Count:607 |
evaluated: (source_item <= end)| yes Evaluation Count:515 | yes Evaluation Count:931 |
| 515-1446 |
| 736 | source_items_to_remove.append(source_item); executed: source_items_to_remove.append(source_item);Execution Count:515 | 515 |
| 737 | } executed: }Execution Count:2053 | 2053 |
| 738 | | - |
| 739 | remove_source_items(source_to_proxy, proxy_to_source, source_items_to_remove, | - |
| 740 | source_parent, orient); | - |
| 741 | } executed: }Execution Count:78 | 78 |
| 742 | | - |
| 743 | | - |
| 744 | | - |
| 745 | | - |
| 746 | | - |
| 747 | | - |
| 748 | void QSortFilterProxyModelPrivate::source_items_removed( | - |
| 749 | const QModelIndex &source_parent, int start, int end, Qt::Orientation orient) | - |
| 750 | { | - |
| 751 | if ((start < 0) || (end < 0)) partially evaluated: (start < 0)| no Evaluation Count:0 | yes Evaluation Count:80 |
partially evaluated: (end < 0)| no Evaluation Count:0 | yes Evaluation Count:80 |
| 0-80 |
| 752 | return; | 0 |
| 753 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 754 | if (it == source_index_mapping.constEnd()) { evaluated: it == source_index_mapping.constEnd()| yes Evaluation Count:2 | yes Evaluation Count:78 |
| 2-78 |
| 755 | | - |
| 756 | return; executed: return;Execution Count:2 | 2 |
| 757 | } | - |
| 758 | | - |
| 759 | Mapping *m = it.value(); | - |
| 760 | QVector<int> &source_to_proxy = (orient == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:43 | yes Evaluation Count:35 |
| 35-43 |
| 761 | QVector<int> &proxy_to_source = (orient == Qt::Vertical) ? m->source_rows : m->source_columns; evaluated: (orient == Qt::Vertical)| yes Evaluation Count:43 | yes Evaluation Count:35 |
| 35-43 |
| 762 | | - |
| 763 | if (end >= source_to_proxy.size()) partially evaluated: end >= source_to_proxy.size()| no Evaluation Count:0 | yes Evaluation Count:78 |
| 0-78 |
| 764 | end = source_to_proxy.size() - 1; never executed: end = source_to_proxy.size() - 1; | 0 |
| 765 | | - |
| 766 | | - |
| 767 | int delta_item_count = end - start + 1; | - |
| 768 | source_to_proxy.remove(start, delta_item_count); | - |
| 769 | | - |
| 770 | int proxy_count = proxy_to_source.size(); | - |
| 771 | if (proxy_count > source_to_proxy.size()) { partially evaluated: proxy_count > source_to_proxy.size()| no Evaluation Count:0 | yes Evaluation Count:78 |
| 0-78 |
| 772 | | - |
| 773 | QMessageLogger("itemmodels/qsortfilterproxymodel.cpp", 887, __PRETTY_FUNCTION__).warning("QSortFilterProxyModel: inconsistent changes reported by source model"); | - |
| 774 | QSortFilterProxyModel * const q = q_func(); | - |
| 775 | q->beginResetModel(); | - |
| 776 | remove_from_mapping(source_parent); | - |
| 777 | q->endResetModel(); | - |
| 778 | return; | 0 |
| 779 | } | - |
| 780 | | - |
| 781 | | - |
| 782 | for (int proxy_item = 0; proxy_item < proxy_count; ++proxy_item) { evaluated: proxy_item < proxy_count| yes Evaluation Count:1538 | yes Evaluation Count:78 |
| 78-1538 |
| 783 | int source_item = proxy_to_source.at(proxy_item); | - |
| 784 | if (source_item >= start) { evaluated: source_item >= start| yes Evaluation Count:931 | yes Evaluation Count:607 |
| 607-931 |
| 785 | qt_noop(); | - |
| 786 | proxy_to_source.replace(proxy_item, source_item - delta_item_count); | - |
| 787 | } executed: }Execution Count:931 | 931 |
| 788 | } executed: }Execution Count:1538 | 1538 |
| 789 | build_source_to_proxy_mapping(proxy_to_source, source_to_proxy); | - |
| 790 | | - |
| 791 | updateChildrenMapping(source_parent, m, orient, start, end, delta_item_count, true); | - |
| 792 | | - |
| 793 | } executed: }Execution Count:78 | 78 |
| 794 | | - |
| 795 | | - |
| 796 | | - |
| 797 | | - |
| 798 | | - |
| 799 | | - |
| 800 | void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping, | - |
| 801 | Qt::Orientation orient, int start, int end, int delta_item_count, bool remove) | - |
| 802 | { | - |
| 803 | | - |
| 804 | QVector<QPair<QModelIndex, Mapping*> > moved_source_index_mappings; | - |
| 805 | QVector<QModelIndex>::iterator it2 = parent_mapping->mapped_children.begin(); | - |
| 806 | for ( ; it2 != parent_mapping->mapped_children.end();) { evaluated: it2 != parent_mapping->mapped_children.end()| yes Evaluation Count:330 | yes Evaluation Count:2336 |
| 330-2336 |
| 807 | const QModelIndex source_child_index = *it2; | - |
| 808 | const int pos = (orient == Qt::Vertical) evaluated: (orient == Qt::Vertical)| yes Evaluation Count:179 | yes Evaluation Count:151 |
| 151-179 |
| 809 | ? source_child_index.row() | - |
| 810 | : source_child_index.column(); | - |
| 811 | if (pos < start) { evaluated: pos < start| yes Evaluation Count:80 | yes Evaluation Count:250 |
| 80-250 |
| 812 | | - |
| 813 | ++it2; | - |
| 814 | } else if (remove && pos <= end) { executed: }Execution Count:80 evaluated: remove| yes Evaluation Count:30 | yes Evaluation Count:220 |
evaluated: pos <= end| yes Evaluation Count:14 | yes Evaluation Count:16 |
| 14-220 |
| 815 | | - |
| 816 | it2 = parent_mapping->mapped_children.erase(it2); | - |
| 817 | remove_from_mapping(source_child_index); | - |
| 818 | } else { executed: }Execution Count:14 | 14 |
| 819 | | - |
| 820 | QModelIndex new_index; | - |
| 821 | const int newpos = remove ? pos - delta_item_count : pos + delta_item_count; evaluated: remove| yes Evaluation Count:16 | yes Evaluation Count:220 |
| 16-220 |
| 822 | if (orient == Qt::Vertical) { evaluated: orient == Qt::Vertical| yes Evaluation Count:121 | yes Evaluation Count:115 |
| 115-121 |
| 823 | new_index = model->index(newpos, | - |
| 824 | source_child_index.column(), | - |
| 825 | source_parent); | - |
| 826 | } else { executed: }Execution Count:121 | 121 |
| 827 | new_index = model->index(source_child_index.row(), | - |
| 828 | newpos, | - |
| 829 | source_parent); | - |
| 830 | } executed: }Execution Count:115 | 115 |
| 831 | *it2 = new_index; | - |
| 832 | ++it2; | - |
| 833 | | - |
| 834 | | - |
| 835 | Mapping *cm = source_index_mapping.take(source_child_index); | - |
| 836 | qt_noop(); | - |
| 837 | | - |
| 838 | moved_source_index_mappings.append(QPair<QModelIndex, Mapping*>(new_index, cm)); | - |
| 839 | } executed: }Execution Count:236 | 236 |
| 840 | } | - |
| 841 | | - |
| 842 | | - |
| 843 | QVector<QPair<QModelIndex, Mapping*> >::iterator it = moved_source_index_mappings.begin(); | - |
| 844 | for (; it != moved_source_index_mappings.end(); ++it) { evaluated: it != moved_source_index_mappings.end()| yes Evaluation Count:236 | yes Evaluation Count:2336 |
| 236-2336 |
| 845 | | - |
| 846 | | - |
| 847 | | - |
| 848 | | - |
| 849 | (*it).second->map_iter = source_index_mapping.insert((*it).first, (*it).second); | - |
| 850 | | - |
| 851 | } executed: }Execution Count:236 | 236 |
| 852 | } executed: }Execution Count:2336 | 2336 |
| 853 | | - |
| 854 | | - |
| 855 | | - |
| 856 | | - |
| 857 | void QSortFilterProxyModelPrivate::proxy_item_range( | - |
| 858 | const QVector<int> &source_to_proxy, const QVector<int> &source_items, | - |
| 859 | int &proxy_low, int &proxy_high) const | - |
| 860 | { | - |
| 861 | proxy_low = 2147483647; | - |
| 862 | proxy_high = (-2147483647 - 1); | - |
| 863 | for (int i = 0; i < source_items.count(); ++i) { evaluated: i < source_items.count()| yes Evaluation Count:6544 | yes Evaluation Count:6544 |
| 6544 |
| 864 | int proxy_item = source_to_proxy.at(source_items.at(i)); | - |
| 865 | qt_noop(); | - |
| 866 | if (proxy_item < proxy_low) partially evaluated: proxy_item < proxy_low| yes Evaluation Count:6544 | no Evaluation Count:0 |
| 0-6544 |
| 867 | proxy_low = proxy_item; executed: proxy_low = proxy_item;Execution Count:6544 | 6544 |
| 868 | if (proxy_item > proxy_high) partially evaluated: proxy_item > proxy_high| yes Evaluation Count:6544 | no Evaluation Count:0 |
| 0-6544 |
| 869 | proxy_high = proxy_item; executed: proxy_high = proxy_item;Execution Count:6544 | 6544 |
| 870 | } executed: }Execution Count:6544 | 6544 |
| 871 | } executed: }Execution Count:6544 | 6544 |
| 872 | | - |
| 873 | | - |
| 874 | | - |
| 875 | | - |
| 876 | void QSortFilterProxyModelPrivate::build_source_to_proxy_mapping( | - |
| 877 | const QVector<int> &proxy_to_source, QVector<int> &source_to_proxy) const | - |
| 878 | { | - |
| 879 | source_to_proxy.fill(-1); | - |
| 880 | int proxy_count = proxy_to_source.size(); | - |
| 881 | for (int i = 0; i < proxy_count; ++i) evaluated: i < proxy_count| yes Evaluation Count:109994 | yes Evaluation Count:6178 |
| 6178-109994 |
| 882 | source_to_proxy[proxy_to_source.at(i)] = i; executed: source_to_proxy[proxy_to_source.at(i)] = i;Execution Count:109994 | 109994 |
| 883 | } executed: }Execution Count:6178 | 6178 |
| 884 | | - |
| 885 | | - |
| 886 | | - |
| 887 | | - |
| 888 | | - |
| 889 | | - |
| 890 | | - |
| 891 | QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() | - |
| 892 | { | - |
| 893 | QSortFilterProxyModel * const q = q_func(); | - |
| 894 | QModelIndexPairList source_indexes; | - |
| 895 | for (QForeachContainer<__typeof__(persistent.indexes)> _container_(persistent.indexes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QPersistentModelIndexData *data = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 896 | QModelIndex proxy_index = data->index; | - |
| 897 | QModelIndex source_index = q->mapToSource(proxy_index); | - |
| 898 | source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index))); | - |
| 899 | } executed: }Execution Count:373 | 373 |
| 900 | return source_indexes; executed: return source_indexes;Execution Count:1024 | 1024 |
| 901 | } | - |
| 902 | | - |
| 903 | | - |
| 904 | | - |
| 905 | | - |
| 906 | | - |
| 907 | | - |
| 908 | | - |
| 909 | void QSortFilterProxyModelPrivate::update_persistent_indexes( | - |
| 910 | const QModelIndexPairList &source_indexes) | - |
| 911 | { | - |
| 912 | QSortFilterProxyModel * const q = q_func(); | - |
| 913 | QModelIndexList from, to; | - |
| 914 | for (int i = 0; i < source_indexes.count(); ++i) { evaluated: i < source_indexes.count()| yes Evaluation Count:373 | yes Evaluation Count:1026 |
| 373-1026 |
| 915 | QModelIndex source_index = source_indexes.at(i).second; | - |
| 916 | QModelIndex old_proxy_index = source_indexes.at(i).first; | - |
| 917 | create_mapping(source_index.parent()); | - |
| 918 | QModelIndex proxy_index = q->mapFromSource(source_index); | - |
| 919 | from << old_proxy_index; | - |
| 920 | to << proxy_index; | - |
| 921 | } executed: }Execution Count:373 | 373 |
| 922 | q->changePersistentIndexList(from, to); | - |
| 923 | } executed: }Execution Count:1026 | 1026 |
| 924 | void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_parent) | - |
| 925 | { | - |
| 926 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 927 | if (it == source_index_mapping.constEnd()) evaluated: it == source_index_mapping.constEnd()| yes Evaluation Count:11 | yes Evaluation Count:376 |
| 11-376 |
| 928 | return; executed: return;Execution Count:11 | 11 |
| 929 | Mapping *m = it.value(); | - |
| 930 | QSet<int> rows_removed = handle_filter_changed(m->proxy_rows, m->source_rows, source_parent, Qt::Vertical); | - |
| 931 | QSet<int> columns_removed = handle_filter_changed(m->proxy_columns, m->source_columns, source_parent, Qt::Horizontal); | - |
| 932 | | - |
| 933 | | - |
| 934 | | - |
| 935 | | - |
| 936 | | - |
| 937 | const QVector<QModelIndex> mappedChildren = m->mapped_children; | - |
| 938 | QVector<int> indexesToRemove; | - |
| 939 | for (int i = 0; i < mappedChildren.size(); ++i) { evaluated: i < mappedChildren.size()| yes Evaluation Count:178 | yes Evaluation Count:376 |
| 178-376 |
| 940 | const QModelIndex source_child_index = mappedChildren.at(i); | - |
| 941 | if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) { evaluated: rows_removed.contains(source_child_index.row())| yes Evaluation Count:3 | yes Evaluation Count:175 |
partially evaluated: columns_removed.contains(source_child_index.column())| no Evaluation Count:0 | yes Evaluation Count:175 |
| 0-175 |
| 942 | indexesToRemove.push_back(i); | - |
| 943 | remove_from_mapping(source_child_index); | - |
| 944 | } else { executed: }Execution Count:3 | 3 |
| 945 | filter_changed(source_child_index); | - |
| 946 | } executed: }Execution Count:175 | 175 |
| 947 | } | - |
| 948 | QVector<int>::const_iterator removeIt = indexesToRemove.constEnd(); | - |
| 949 | const QVector<int>::const_iterator removeBegin = indexesToRemove.constBegin(); | - |
| 950 | | - |
| 951 | | - |
| 952 | | - |
| 953 | | - |
| 954 | | - |
| 955 | | - |
| 956 | while (removeIt != removeBegin) { evaluated: removeIt != removeBegin| yes Evaluation Count:3 | yes Evaluation Count:376 |
| 3-376 |
| 957 | --removeIt; | - |
| 958 | m->mapped_children.remove(*removeIt); | - |
| 959 | } executed: }Execution Count:3 | 3 |
| 960 | } executed: }Execution Count:376 | 376 |
| 961 | | - |
| 962 | | - |
| 963 | | - |
| 964 | | - |
| 965 | | - |
| 966 | QSet<int> QSortFilterProxyModelPrivate::handle_filter_changed( | - |
| 967 | QVector<int> &source_to_proxy, QVector<int> &proxy_to_source, | - |
| 968 | const QModelIndex &source_parent, Qt::Orientation orient) | - |
| 969 | { | - |
| 970 | QSortFilterProxyModel * const q = q_func(); | - |
| 971 | | - |
| 972 | QVector<int> source_items_remove; | - |
| 973 | for (int i = 0; i < proxy_to_source.count(); ++i) { evaluated: i < proxy_to_source.count()| yes Evaluation Count:21712 | yes Evaluation Count:752 |
| 752-21712 |
| 974 | const int source_item = proxy_to_source.at(i); | - |
| 975 | if ((orient == Qt::Vertical) evaluated: (orient == Qt::Vertical)| yes Evaluation Count:15904 | yes Evaluation Count:5808 |
| 5808-15904 |
| 976 | ? !q->filterAcceptsRow(source_item, source_parent) | - |
| 977 | : !q->filterAcceptsColumn(source_item, source_parent)) { | - |
| 978 | | - |
| 979 | source_items_remove.append(source_item); | - |
| 980 | } executed: }Execution Count:82 | 82 |
| 981 | } executed: }Execution Count:21712 | 21712 |
| 982 | | - |
| 983 | QVector<int> source_items_insert; | - |
| 984 | int source_count = source_to_proxy.size(); | - |
| 985 | for (int source_item = 0; source_item < source_count; ++source_item) { evaluated: source_item < source_count| yes Evaluation Count:21761 | yes Evaluation Count:752 |
| 752-21761 |
| 986 | if (source_to_proxy.at(source_item) == -1) { evaluated: source_to_proxy.at(source_item) == -1| yes Evaluation Count:49 | yes Evaluation Count:21712 |
| 49-21712 |
| 987 | if ((orient == Qt::Vertical) partially evaluated: (orient == Qt::Vertical)| yes Evaluation Count:49 | no Evaluation Count:0 |
| 0-49 |
| 988 | ? q->filterAcceptsRow(source_item, source_parent) | - |
| 989 | : q->filterAcceptsColumn(source_item, source_parent)) { | - |
| 990 | | - |
| 991 | source_items_insert.append(source_item); | - |
| 992 | } executed: }Execution Count:34 | 34 |
| 993 | } executed: }Execution Count:49 | 49 |
| 994 | } executed: }Execution Count:21761 | 21761 |
| 995 | if (!source_items_remove.isEmpty() || !source_items_insert.isEmpty()) { evaluated: !source_items_remove.isEmpty()| yes Evaluation Count:35 | yes Evaluation Count:717 |
evaluated: !source_items_insert.isEmpty()| yes Evaluation Count:10 | yes Evaluation Count:707 |
| 10-717 |
| 996 | | - |
| 997 | remove_source_items(source_to_proxy, proxy_to_source, | - |
| 998 | source_items_remove, source_parent, orient); | - |
| 999 | if (orient == Qt::Vertical) partially evaluated: orient == Qt::Vertical| yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
| 1000 | sort_source_rows(source_items_insert, source_parent); executed: sort_source_rows(source_items_insert, source_parent);Execution Count:45 | 45 |
| 1001 | insert_source_items(source_to_proxy, proxy_to_source, | - |
| 1002 | source_items_insert, source_parent, orient); | - |
| 1003 | } executed: }Execution Count:45 | 45 |
| 1004 | return qVectorToSet(source_items_remove); executed: return qVectorToSet(source_items_remove);Execution Count:752 | 752 |
| 1005 | } | - |
| 1006 | | - |
| 1007 | void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &source_top_left, | - |
| 1008 | const QModelIndex &source_bottom_right) | - |
| 1009 | { | - |
| 1010 | QSortFilterProxyModel * const q = q_func(); | - |
| 1011 | if (!source_top_left.isValid() || !source_bottom_right.isValid()) partially evaluated: !source_top_left.isValid()| no Evaluation Count:0 | yes Evaluation Count:6854 |
partially evaluated: !source_bottom_right.isValid()| no Evaluation Count:0 | yes Evaluation Count:6854 |
| 0-6854 |
| 1012 | return; | 0 |
| 1013 | QModelIndex source_parent = source_top_left.parent(); | - |
| 1014 | IndexMap::const_iterator it = source_index_mapping.constFind(source_parent); | - |
| 1015 | if (it == source_index_mapping.constEnd()) { evaluated: it == source_index_mapping.constEnd()| yes Evaluation Count:5 | yes Evaluation Count:6849 |
| 5-6849 |
| 1016 | | - |
| 1017 | return; executed: return;Execution Count:5 | 5 |
| 1018 | } | - |
| 1019 | Mapping *m = it.value(); | - |
| 1020 | | - |
| 1021 | | - |
| 1022 | QVector<int> source_rows_remove; | - |
| 1023 | QVector<int> source_rows_insert; | - |
| 1024 | QVector<int> source_rows_change; | - |
| 1025 | QVector<int> source_rows_resort; | - |
| 1026 | int end = qMin(source_bottom_right.row(), m->proxy_rows.count() - 1); | - |
| 1027 | for (int source_row = source_top_left.row(); source_row <= end; ++source_row) { evaluated: source_row <= end| yes Evaluation Count:6849 | yes Evaluation Count:6849 |
| 6849 |
| 1028 | if (dynamic_sortfilter) { evaluated: dynamic_sortfilter| yes Evaluation Count:6842 | yes Evaluation Count:7 |
| 7-6842 |
| 1029 | if (m->proxy_rows.at(source_row) != -1) { evaluated: m->proxy_rows.at(source_row) != -1| yes Evaluation Count:6538 | yes Evaluation Count:304 |
| 304-6538 |
| 1030 | if (!q->filterAcceptsRow(source_row, source_parent)) { evaluated: !q->filterAcceptsRow(source_row, source_parent)| yes Evaluation Count:1 | yes Evaluation Count:6537 |
| 1-6537 |
| 1031 | | - |
| 1032 | source_rows_remove.append(source_row); | - |
| 1033 | } else if (source_sort_column >= source_top_left.column() && source_sort_column <= source_bottom_right.column()) { executed: }Execution Count:1 evaluated: source_sort_column >= source_top_left.column()| yes Evaluation Count:5 | yes Evaluation Count:6532 |
partially evaluated: source_sort_column <= source_bottom_right.column()| yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-6532 |
| 1034 | | - |
| 1035 | source_rows_resort.append(source_row); | - |
| 1036 | } else { executed: }Execution Count:5 | 5 |
| 1037 | | - |
| 1038 | source_rows_change.append(source_row); | - |
| 1039 | } executed: }Execution Count:6532 | 6532 |
| 1040 | } else { | - |
| 1041 | if (!itemsBeingRemoved.contains(source_parent, source_row) && q->filterAcceptsRow(source_row, source_parent)) { partially evaluated: !itemsBeingRemoved.contains(source_parent, source_row)| yes Evaluation Count:304 | no Evaluation Count:0 |
evaluated: q->filterAcceptsRow(source_row, source_parent)| yes Evaluation Count:3 | yes Evaluation Count:301 |
| 0-304 |
| 1042 | | - |
| 1043 | source_rows_insert.append(source_row); | - |
| 1044 | } executed: }Execution Count:3 | 3 |
| 1045 | } executed: }Execution Count:304 | 304 |
| 1046 | } else { | - |
| 1047 | if (m->proxy_rows.at(source_row) != -1) partially evaluated: m->proxy_rows.at(source_row) != -1| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 1048 | source_rows_change.append(source_row); executed: source_rows_change.append(source_row);Execution Count:7 | 7 |
| 1049 | } executed: }Execution Count:7 | 7 |
| 1050 | } | - |
| 1051 | | - |
| 1052 | if (!source_rows_remove.isEmpty()) { evaluated: !source_rows_remove.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:6848 |
| 1-6848 |
| 1053 | remove_source_items(m->proxy_rows, m->source_rows, | - |
| 1054 | source_rows_remove, source_parent, Qt::Vertical); | - |
| 1055 | QSet<int> source_rows_remove_set = qVectorToSet(source_rows_remove); | - |
| 1056 | QVector<QModelIndex>::iterator childIt = m->mapped_children.end(); | - |
| 1057 | while (childIt != m->mapped_children.begin()) { evaluated: childIt != m->mapped_children.begin()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1058 | --childIt; | - |
| 1059 | const QModelIndex source_child_index = *childIt; | - |
| 1060 | if (source_rows_remove_set.contains(source_child_index.row())) { partially evaluated: source_rows_remove_set.contains(source_child_index.row())| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1061 | childIt = m->mapped_children.erase(childIt); | - |
| 1062 | remove_from_mapping(source_child_index); | - |
| 1063 | } executed: }Execution Count:1 | 1 |
| 1064 | } executed: }Execution Count:1 | 1 |
| 1065 | } executed: }Execution Count:1 | 1 |
| 1066 | | - |
| 1067 | if (!source_rows_resort.isEmpty()) { evaluated: !source_rows_resort.isEmpty()| yes Evaluation Count:5 | yes Evaluation Count:6844 |
| 5-6844 |
| 1068 | | - |
| 1069 | QList<QPersistentModelIndex> parents; | - |
| 1070 | parents << q->mapFromSource(source_parent); | - |
| 1071 | q->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint); | - |
| 1072 | QModelIndexPairList source_indexes = store_persistent_indexes(); | - |
| 1073 | remove_source_items(m->proxy_rows, m->source_rows, source_rows_resort, | - |
| 1074 | source_parent, Qt::Vertical, false); | - |
| 1075 | sort_source_rows(source_rows_resort, source_parent); | - |
| 1076 | insert_source_items(m->proxy_rows, m->source_rows, source_rows_resort, | - |
| 1077 | source_parent, Qt::Vertical, false); | - |
| 1078 | update_persistent_indexes(source_indexes); | - |
| 1079 | q->layoutChanged(parents, QAbstractItemModel::VerticalSortHint); | - |
| 1080 | | - |
| 1081 | source_rows_change += source_rows_resort; | - |
| 1082 | } executed: }Execution Count:5 | 5 |
| 1083 | | - |
| 1084 | if (!source_rows_change.isEmpty()) { evaluated: !source_rows_change.isEmpty()| yes Evaluation Count:6544 | yes Evaluation Count:305 |
| 305-6544 |
| 1085 | | - |
| 1086 | int proxy_start_row; | - |
| 1087 | int proxy_end_row; | - |
| 1088 | proxy_item_range(m->proxy_rows, source_rows_change, | - |
| 1089 | proxy_start_row, proxy_end_row); | - |
| 1090 | | - |
| 1091 | if (proxy_end_row >= 0) { partially evaluated: proxy_end_row >= 0| yes Evaluation Count:6544 | no Evaluation Count:0 |
| 0-6544 |
| 1092 | | - |
| 1093 | int source_left_column = source_top_left.column(); | - |
| 1094 | while (source_left_column < source_bottom_right.column() partially evaluated: source_left_column < source_bottom_right.column()| no Evaluation Count:0 | yes Evaluation Count:6544 |
| 0-6544 |
| 1095 | && m->proxy_columns.at(source_left_column) == -1) never evaluated: m->proxy_columns.at(source_left_column) == -1 | 0 |
| 1096 | ++source_left_column; never executed: ++source_left_column; | 0 |
| 1097 | const QModelIndex proxy_top_left = create_index( | - |
| 1098 | proxy_start_row, m->proxy_columns.at(source_left_column), it); | - |
| 1099 | int source_right_column = source_bottom_right.column(); | - |
| 1100 | while (source_right_column > source_top_left.column() partially evaluated: source_right_column > source_top_left.column()| no Evaluation Count:0 | yes Evaluation Count:6544 |
| 0-6544 |
| 1101 | && m->proxy_columns.at(source_right_column) == -1) never evaluated: m->proxy_columns.at(source_right_column) == -1 | 0 |
| 1102 | --source_right_column; never executed: --source_right_column; | 0 |
| 1103 | const QModelIndex proxy_bottom_right = create_index( | - |
| 1104 | proxy_end_row, m->proxy_columns.at(source_right_column), it); | - |
| 1105 | q->dataChanged(proxy_top_left, proxy_bottom_right); | - |
| 1106 | } executed: }Execution Count:6544 | 6544 |
| 1107 | } executed: }Execution Count:6544 | 6544 |
| 1108 | | - |
| 1109 | if (!source_rows_insert.isEmpty()) { evaluated: !source_rows_insert.isEmpty()| yes Evaluation Count:3 | yes Evaluation Count:6846 |
| 3-6846 |
| 1110 | sort_source_rows(source_rows_insert, source_parent); | - |
| 1111 | insert_source_items(m->proxy_rows, m->source_rows, | - |
| 1112 | source_rows_insert, source_parent, Qt::Vertical); | - |
| 1113 | } executed: }Execution Count:3 | 3 |
| 1114 | } executed: }Execution Count:6849 | 6849 |
| 1115 | | - |
| 1116 | void QSortFilterProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orientation, | - |
| 1117 | int start, int end) | - |
| 1118 | { | - |
| 1119 | qt_noop(); | - |
| 1120 | | - |
| 1121 | QSortFilterProxyModel * const q = q_func(); | - |
| 1122 | Mapping *m = create_mapping(QModelIndex()).value(); | - |
| 1123 | | - |
| 1124 | const QVector<int> &source_to_proxy = (orientation == Qt::Vertical) ? m->proxy_rows : m->proxy_columns; evaluated: (orientation == Qt::Vertical)| yes Evaluation Count:9 | yes Evaluation Count:120 |
| 9-120 |
| 1125 | | - |
| 1126 | QVector<int> proxy_positions; | - |
| 1127 | proxy_positions.reserve(end - start + 1); | - |
| 1128 | { | - |
| 1129 | qt_noop(); | - |
| 1130 | QVector<int>::const_iterator it = source_to_proxy.constBegin() + start; | - |
| 1131 | const QVector<int>::const_iterator endIt = source_to_proxy.constBegin() + end + 1; | - |
| 1132 | for ( ; it != endIt; ++it) { evaluated: it != endIt| yes Evaluation Count:138 | yes Evaluation Count:129 |
| 129-138 |
| 1133 | if (*it != -1) evaluated: *it != -1| yes Evaluation Count:122 | yes Evaluation Count:16 |
| 16-122 |
| 1134 | proxy_positions.push_back(*it); executed: proxy_positions.push_back(*it);Execution Count:122 | 122 |
| 1135 | } executed: }Execution Count:138 | 138 |
| 1136 | } | - |
| 1137 | | - |
| 1138 | std::sort(proxy_positions.begin(), proxy_positions.end()); | - |
| 1139 | | - |
| 1140 | int last_index = 0; | - |
| 1141 | const int numItems = proxy_positions.size(); | - |
| 1142 | while (last_index < numItems) { evaluated: last_index < numItems| yes Evaluation Count:113 | yes Evaluation Count:129 |
| 113-129 |
| 1143 | const int proxyStart = proxy_positions.at(last_index); | - |
| 1144 | int proxyEnd = proxyStart; | - |
| 1145 | ++last_index; | - |
| 1146 | for (int i = last_index; i < numItems; ++i) { evaluated: i < numItems| yes Evaluation Count:9 | yes Evaluation Count:113 |
| 9-113 |
| 1147 | if (proxy_positions.at(i) == proxyEnd + 1) { partially evaluated: proxy_positions.at(i) == proxyEnd + 1| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 1148 | ++last_index; | - |
| 1149 | ++proxyEnd; | - |
| 1150 | } else { executed: }Execution Count:9 | 9 |
| 1151 | break; | 0 |
| 1152 | } | - |
| 1153 | } | - |
| 1154 | q->headerDataChanged(orientation, proxyStart, proxyEnd); | - |
| 1155 | } executed: }Execution Count:113 | 113 |
| 1156 | } executed: }Execution Count:129 | 129 |
| 1157 | | - |
| 1158 | void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset() | - |
| 1159 | { | - |
| 1160 | QSortFilterProxyModel * const q = q_func(); | - |
| 1161 | q->beginResetModel(); | - |
| 1162 | } executed: }Execution Count:112 | 112 |
| 1163 | | - |
| 1164 | void QSortFilterProxyModelPrivate::_q_sourceReset() | - |
| 1165 | { | - |
| 1166 | QSortFilterProxyModel * const q = q_func(); | - |
| 1167 | invalidatePersistentIndexes(); | - |
| 1168 | _q_clearMapping(); | - |
| 1169 | | - |
| 1170 | q->endResetModel(); | - |
| 1171 | update_source_sort_column(); | - |
| 1172 | if (dynamic_sortfilter) partially evaluated: dynamic_sortfilter| yes Evaluation Count:112 | no Evaluation Count:0 |
| 0-112 |
| 1173 | sort(); executed: sort();Execution Count:112 | 112 |
| 1174 | } executed: }Execution Count:112 | 112 |
| 1175 | | - |
| 1176 | void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint) | - |
| 1177 | { | - |
| 1178 | QSortFilterProxyModel * const q = q_func(); | - |
| 1179 | saved_persistent_indexes.clear(); | - |
| 1180 | | - |
| 1181 | QList<QPersistentModelIndex> parents; | - |
| 1182 | for (QForeachContainer<__typeof__(sourceParents)> _container_(sourceParents); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QPersistentModelIndex &parent = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1183 | if (!parent.isValid()) { evaluated: !parent.isValid()| yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
| 1184 | parents << QPersistentModelIndex(); | - |
| 1185 | continue; executed: continue;Execution Count:1 | 1 |
| 1186 | } | - |
| 1187 | const QModelIndex mappedParent = q->mapFromSource(parent); | - |
| 1188 | | - |
| 1189 | if (mappedParent.isValid()) evaluated: mappedParent.isValid()| yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
| 1190 | parents << mappedParent; executed: parents << mappedParent;Execution Count:2 | 2 |
| 1191 | } executed: }Execution Count:5 | 5 |
| 1192 | | - |
| 1193 | | - |
| 1194 | if (!sourceParents.isEmpty() && parents.isEmpty()) evaluated: !sourceParents.isEmpty()| yes Evaluation Count:4 | yes Evaluation Count:1 |
evaluated: parents.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-4 |
| 1195 | return; executed: return;Execution Count:1 | 1 |
| 1196 | | - |
| 1197 | q->layoutAboutToBeChanged(parents, hint); | - |
| 1198 | if (persistent.indexes.isEmpty()) evaluated: persistent.indexes.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
| 1199 | return; executed: return;Execution Count:1 | 1 |
| 1200 | | - |
| 1201 | saved_persistent_indexes = store_persistent_indexes(); | - |
| 1202 | } executed: }Execution Count:3 | 3 |
| 1203 | | - |
| 1204 | void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint) | - |
| 1205 | { | - |
| 1206 | QSortFilterProxyModel * const q = q_func(); | - |
| 1207 | | - |
| 1208 | | - |
| 1209 | | - |
| 1210 | qDeleteAll(source_index_mapping); | - |
| 1211 | source_index_mapping.clear(); | - |
| 1212 | | - |
| 1213 | update_persistent_indexes(saved_persistent_indexes); | - |
| 1214 | saved_persistent_indexes.clear(); | - |
| 1215 | | - |
| 1216 | if (dynamic_sortfilter && update_source_sort_column()) { partially evaluated: dynamic_sortfilter| yes Evaluation Count:5 | no Evaluation Count:0 |
evaluated: update_source_sort_column()| yes Evaluation Count:1 | yes Evaluation Count:4 |
| 0-5 |
| 1217 | | - |
| 1218 | qDeleteAll(source_index_mapping); | - |
| 1219 | source_index_mapping.clear(); | - |
| 1220 | } executed: }Execution Count:1 | 1 |
| 1221 | | - |
| 1222 | QList<QPersistentModelIndex> parents; | - |
| 1223 | for (QForeachContainer<__typeof__(sourceParents)> _container_(sourceParents); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QPersistentModelIndex &parent = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 1224 | if (!parent.isValid()) { evaluated: !parent.isValid()| yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
| 1225 | parents << QPersistentModelIndex(); | - |
| 1226 | continue; executed: continue;Execution Count:1 | 1 |
| 1227 | } | - |
| 1228 | const QModelIndex mappedParent = q->mapFromSource(parent); | - |
| 1229 | if (mappedParent.isValid()) evaluated: mappedParent.isValid()| yes Evaluation Count:2 | yes Evaluation Count:3 |
| 2-3 |
| 1230 | parents << mappedParent; executed: parents << mappedParent;Execution Count:2 | 2 |
| 1231 | } executed: }Execution Count:5 | 5 |
| 1232 | | - |
| 1233 | if (!sourceParents.isEmpty() && parents.isEmpty()) evaluated: !sourceParents.isEmpty()| yes Evaluation Count:4 | yes Evaluation Count:1 |
evaluated: parents.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-4 |
| 1234 | return; executed: return;Execution Count:1 | 1 |
| 1235 | | - |
| 1236 | q->layoutChanged(parents, hint); | - |
| 1237 | } executed: }Execution Count:4 | 4 |
| 1238 | | - |
| 1239 | void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted( | - |
| 1240 | const QModelIndex &source_parent, int start, int end) | - |
| 1241 | { | - |
| 1242 | (void)start;; | - |
| 1243 | (void)end;; | - |
| 1244 | | - |
| 1245 | | - |
| 1246 | if (can_create_mapping(source_parent)) evaluated: can_create_mapping(source_parent)| yes Evaluation Count:1126 | yes Evaluation Count:1 |
| 1-1126 |
| 1247 | create_mapping(source_parent); executed: create_mapping(source_parent);Execution Count:1126 | 1126 |
| 1248 | } executed: }Execution Count:1127 | 1127 |
| 1249 | | - |
| 1250 | void QSortFilterProxyModelPrivate::_q_sourceRowsInserted( | - |
| 1251 | const QModelIndex &source_parent, int start, int end) | - |
| 1252 | { | - |
| 1253 | source_items_inserted(source_parent, start, end, Qt::Vertical); | - |
| 1254 | if (update_source_sort_column() && dynamic_sortfilter) partially evaluated: update_source_sort_column()| no Evaluation Count:0 | yes Evaluation Count:1127 |
never evaluated: dynamic_sortfilter | 0-1127 |
| 1255 | sort(); | 0 |
| 1256 | } executed: }Execution Count:1127 | 1127 |
| 1257 | | - |
| 1258 | void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeRemoved( | - |
| 1259 | const QModelIndex &source_parent, int start, int end) | - |
| 1260 | { | - |
| 1261 | itemsBeingRemoved = QRowsRemoval(source_parent, start, end); | - |
| 1262 | source_items_about_to_be_removed(source_parent, start, end, | - |
| 1263 | Qt::Vertical); | - |
| 1264 | } executed: }Execution Count:45 | 45 |
| 1265 | | - |
| 1266 | void QSortFilterProxyModelPrivate::_q_sourceRowsRemoved( | - |
| 1267 | const QModelIndex &source_parent, int start, int end) | - |
| 1268 | { | - |
| 1269 | itemsBeingRemoved = QRowsRemoval(); | - |
| 1270 | source_items_removed(source_parent, start, end, Qt::Vertical); | - |
| 1271 | } executed: }Execution Count:45 | 45 |
| 1272 | | - |
| 1273 | void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeMoved( | - |
| 1274 | const QModelIndex &sourceParent, int , int , const QModelIndex &destParent, int ) | - |
| 1275 | { | - |
| 1276 | QSortFilterProxyModel * const q = q_func(); | - |
| 1277 | | - |
| 1278 | | - |
| 1279 | | - |
| 1280 | | - |
| 1281 | | - |
| 1282 | | - |
| 1283 | saved_persistent_indexes.clear(); | - |
| 1284 | | - |
| 1285 | QList<QPersistentModelIndex> parents; | - |
| 1286 | parents << q->mapFromSource(sourceParent); | - |
| 1287 | if (sourceParent != destParent) partially evaluated: sourceParent != destParent| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 1288 | parents << q->mapFromSource(destParent); executed: parents << q->mapFromSource(destParent);Execution Count:4 | 4 |
| 1289 | q->layoutAboutToBeChanged(parents); | - |
| 1290 | if (persistent.indexes.isEmpty()) partially evaluated: persistent.indexes.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 1291 | return; | 0 |
| 1292 | saved_persistent_indexes = store_persistent_indexes(); | - |
| 1293 | } executed: }Execution Count:4 | 4 |
| 1294 | | - |
| 1295 | void QSortFilterProxyModelPrivate::_q_sourceRowsMoved( | - |
| 1296 | const QModelIndex &sourceParent, int , int , const QModelIndex &destParent, int ) | - |
| 1297 | { | - |
| 1298 | QSortFilterProxyModel * const q = q_func(); | - |
| 1299 | | - |
| 1300 | | - |
| 1301 | | - |
| 1302 | qDeleteAll(source_index_mapping); | - |
| 1303 | source_index_mapping.clear(); | - |
| 1304 | | - |
| 1305 | update_persistent_indexes(saved_persistent_indexes); | - |
| 1306 | saved_persistent_indexes.clear(); | - |
| 1307 | | - |
| 1308 | if (dynamic_sortfilter && update_source_sort_column()) { partially evaluated: dynamic_sortfilter| yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: update_source_sort_column()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 1309 | | - |
| 1310 | qDeleteAll(source_index_mapping); | - |
| 1311 | source_index_mapping.clear(); | - |
| 1312 | } | 0 |
| 1313 | | - |
| 1314 | QList<QPersistentModelIndex> parents; | - |
| 1315 | parents << q->mapFromSource(sourceParent); | - |
| 1316 | if (sourceParent != destParent) partially evaluated: sourceParent != destParent| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 1317 | parents << q->mapFromSource(destParent); executed: parents << q->mapFromSource(destParent);Execution Count:4 | 4 |
| 1318 | q->layoutChanged(parents); | - |
| 1319 | } executed: }Execution Count:4 | 4 |
| 1320 | | - |
| 1321 | void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted( | - |
| 1322 | const QModelIndex &source_parent, int start, int end) | - |
| 1323 | { | - |
| 1324 | (void)start;; | - |
| 1325 | (void)end;; | - |
| 1326 | | - |
| 1327 | | - |
| 1328 | if (can_create_mapping(source_parent)) evaluated: can_create_mapping(source_parent)| yes Evaluation Count:1132 | yes Evaluation Count:1 |
| 1-1132 |
| 1329 | create_mapping(source_parent); executed: create_mapping(source_parent);Execution Count:1132 | 1132 |
| 1330 | } executed: }Execution Count:1133 | 1133 |
| 1331 | | - |
| 1332 | void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted( | - |
| 1333 | const QModelIndex &source_parent, int start, int end) | - |
| 1334 | { | - |
| 1335 | const QSortFilterProxyModel * const q = q_func(); | - |
| 1336 | source_items_inserted(source_parent, start, end, Qt::Horizontal); | - |
| 1337 | | - |
| 1338 | if (source_parent.isValid()) evaluated: source_parent.isValid()| yes Evaluation Count:826 | yes Evaluation Count:307 |
| 307-826 |
| 1339 | return; executed: return;Execution Count:826 | 826 |
| 1340 | if (source_sort_column == -1) { evaluated: source_sort_column == -1| yes Evaluation Count:304 | yes Evaluation Count:3 |
| 3-304 |
| 1341 | | - |
| 1342 | if (update_source_sort_column() && dynamic_sortfilter) evaluated: update_source_sort_column()| yes Evaluation Count:1 | yes Evaluation Count:303 |
partially evaluated: dynamic_sortfilter| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-303 |
| 1343 | sort(); executed: sort();Execution Count:1 | 1 |
| 1344 | } else { executed: }Execution Count:304 | 304 |
| 1345 | if (start <= source_sort_column) evaluated: start <= source_sort_column| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 1346 | source_sort_column += end - start + 1; executed: source_sort_column += end - start + 1;Execution Count:1 | 1 |
| 1347 | | - |
| 1348 | proxy_sort_column = q->mapFromSource(model->index(0,source_sort_column, source_parent)).column(); | - |
| 1349 | } executed: }Execution Count:3 | 3 |
| 1350 | } | - |
| 1351 | | - |
| 1352 | void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeRemoved( | - |
| 1353 | const QModelIndex &source_parent, int start, int end) | - |
| 1354 | { | - |
| 1355 | source_items_about_to_be_removed(source_parent, start, end, | - |
| 1356 | Qt::Horizontal); | - |
| 1357 | } executed: }Execution Count:35 | 35 |
| 1358 | | - |
| 1359 | void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved( | - |
| 1360 | const QModelIndex &source_parent, int start, int end) | - |
| 1361 | { | - |
| 1362 | const QSortFilterProxyModel * const q = q_func(); | - |
| 1363 | source_items_removed(source_parent, start, end, Qt::Horizontal); | - |
| 1364 | | - |
| 1365 | if (source_parent.isValid()) evaluated: source_parent.isValid()| yes Evaluation Count:22 | yes Evaluation Count:13 |
| 13-22 |
| 1366 | return; executed: return;Execution Count:22 | 22 |
| 1367 | if (start <= source_sort_column) { evaluated: start <= source_sort_column| yes Evaluation Count:2 | yes Evaluation Count:11 |
| 2-11 |
| 1368 | if (end < source_sort_column) evaluated: end < source_sort_column| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1369 | source_sort_column -= end - start + 1; executed: source_sort_column -= end - start + 1;Execution Count:1 | 1 |
| 1370 | else | - |
| 1371 | source_sort_column = -1; executed: source_sort_column = -1;Execution Count:1 | 1 |
| 1372 | } | - |
| 1373 | | - |
| 1374 | proxy_sort_column = q->mapFromSource(model->index(0,source_sort_column, source_parent)).column(); | - |
| 1375 | } executed: }Execution Count:13 | 13 |
| 1376 | | - |
| 1377 | void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeMoved( | - |
| 1378 | const QModelIndex &sourceParent, int , int , const QModelIndex &destParent, int ) | - |
| 1379 | { | - |
| 1380 | QSortFilterProxyModel * const q = q_func(); | - |
| 1381 | | - |
| 1382 | saved_persistent_indexes.clear(); | - |
| 1383 | | - |
| 1384 | QList<QPersistentModelIndex> parents; | - |
| 1385 | parents << q->mapFromSource(sourceParent); | - |
| 1386 | if (sourceParent != destParent) never evaluated: sourceParent != destParent | 0 |
| 1387 | parents << q->mapFromSource(destParent); never executed: parents << q->mapFromSource(destParent); | 0 |
| 1388 | q->layoutAboutToBeChanged(parents); | - |
| 1389 | | - |
| 1390 | if (persistent.indexes.isEmpty()) never evaluated: persistent.indexes.isEmpty() | 0 |
| 1391 | return; | 0 |
| 1392 | saved_persistent_indexes = store_persistent_indexes(); | - |
| 1393 | } | 0 |
| 1394 | | - |
| 1395 | void QSortFilterProxyModelPrivate::_q_sourceColumnsMoved( | - |
| 1396 | const QModelIndex &sourceParent, int , int , const QModelIndex &destParent, int ) | - |
| 1397 | { | - |
| 1398 | QSortFilterProxyModel * const q = q_func(); | - |
| 1399 | | - |
| 1400 | qDeleteAll(source_index_mapping); | - |
| 1401 | source_index_mapping.clear(); | - |
| 1402 | | - |
| 1403 | update_persistent_indexes(saved_persistent_indexes); | - |
| 1404 | saved_persistent_indexes.clear(); | - |
| 1405 | | - |
| 1406 | if (dynamic_sortfilter && update_source_sort_column()) { never evaluated: dynamic_sortfilter never evaluated: update_source_sort_column() | 0 |
| 1407 | qDeleteAll(source_index_mapping); | - |
| 1408 | source_index_mapping.clear(); | - |
| 1409 | } | 0 |
| 1410 | | - |
| 1411 | QList<QPersistentModelIndex> parents; | - |
| 1412 | parents << q->mapFromSource(sourceParent); | - |
| 1413 | if (sourceParent != destParent) never evaluated: sourceParent != destParent | 0 |
| 1414 | parents << q->mapFromSource(destParent); never executed: parents << q->mapFromSource(destParent); | 0 |
| 1415 | q->layoutChanged(parents); | - |
| 1416 | } | 0 |
| 1417 | QSortFilterProxyModel::QSortFilterProxyModel(QObject *parent) | - |
| 1418 | : QAbstractProxyModel(*new QSortFilterProxyModelPrivate, parent) | - |
| 1419 | { | - |
| 1420 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1421 | d->proxy_sort_column = d->source_sort_column = -1; | - |
| 1422 | d->sort_order = Qt::AscendingOrder; | - |
| 1423 | d->sort_casesensitivity = Qt::CaseSensitive; | - |
| 1424 | d->sort_role = Qt::DisplayRole; | - |
| 1425 | d->sort_localeaware = false; | - |
| 1426 | d->filter_column = 0; | - |
| 1427 | d->filter_role = Qt::DisplayRole; | - |
| 1428 | d->dynamic_sortfilter = true; | - |
| 1429 | connect(this, "2""modelReset()", this, "1""_q_clearMapping()"); | - |
| 1430 | } executed: }Execution Count:264 | 264 |
| 1431 | | - |
| 1432 | | - |
| 1433 | | - |
| 1434 | | - |
| 1435 | QSortFilterProxyModel::~QSortFilterProxyModel() | - |
| 1436 | { | - |
| 1437 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1438 | qDeleteAll(d->source_index_mapping); | - |
| 1439 | d->source_index_mapping.clear(); | - |
| 1440 | } executed: }Execution Count:261 | 261 |
| 1441 | | - |
| 1442 | | - |
| 1443 | | - |
| 1444 | | - |
| 1445 | void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel) | - |
| 1446 | { | - |
| 1447 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1448 | | - |
| 1449 | beginResetModel(); | - |
| 1450 | | - |
| 1451 | disconnect(d->model, "2""dataChanged(QModelIndex,QModelIndex)", | - |
| 1452 | this, "1""_q_sourceDataChanged(QModelIndex,QModelIndex)"); | - |
| 1453 | | - |
| 1454 | disconnect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)", | - |
| 1455 | this, "1""_q_sourceHeaderDataChanged(Qt::Orientation,int,int)"); | - |
| 1456 | | - |
| 1457 | disconnect(d->model, "2""rowsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1458 | this, "1""_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)"); | - |
| 1459 | | - |
| 1460 | disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
| 1461 | this, "1""_q_sourceRowsInserted(QModelIndex,int,int)"); | - |
| 1462 | | - |
| 1463 | disconnect(d->model, "2""columnsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1464 | this, "1""_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)"); | - |
| 1465 | | - |
| 1466 | disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)", | - |
| 1467 | this, "1""_q_sourceColumnsInserted(QModelIndex,int,int)"); | - |
| 1468 | | - |
| 1469 | disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1470 | this, "1""_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)"); | - |
| 1471 | | - |
| 1472 | disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
| 1473 | this, "1""_q_sourceRowsRemoved(QModelIndex,int,int)"); | - |
| 1474 | | - |
| 1475 | disconnect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1476 | this, "1""_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)"); | - |
| 1477 | | - |
| 1478 | disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)", | - |
| 1479 | this, "1""_q_sourceColumnsRemoved(QModelIndex,int,int)"); | - |
| 1480 | | - |
| 1481 | disconnect(d->model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1482 | this, "1""_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1483 | | - |
| 1484 | disconnect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1485 | this, "1""_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1486 | | - |
| 1487 | disconnect(d->model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1488 | this, "1""_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1489 | | - |
| 1490 | disconnect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1491 | this, "1""_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1492 | | - |
| 1493 | disconnect(d->model, "2""layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)", | - |
| 1494 | this, "1""_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)"); | - |
| 1495 | | - |
| 1496 | disconnect(d->model, "2""layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)", | - |
| 1497 | this, "1""_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)"); | - |
| 1498 | | - |
| 1499 | disconnect(d->model, "2""modelAboutToBeReset()", this, "1""_q_sourceAboutToBeReset()"); | - |
| 1500 | disconnect(d->model, "2""modelReset()", this, "1""_q_sourceReset()"); | - |
| 1501 | | - |
| 1502 | QAbstractProxyModel::setSourceModel(sourceModel); | - |
| 1503 | | - |
| 1504 | connect(d->model, "2""dataChanged(QModelIndex,QModelIndex)", | - |
| 1505 | this, "1""_q_sourceDataChanged(QModelIndex,QModelIndex)"); | - |
| 1506 | | - |
| 1507 | connect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)", | - |
| 1508 | this, "1""_q_sourceHeaderDataChanged(Qt::Orientation,int,int)"); | - |
| 1509 | | - |
| 1510 | connect(d->model, "2""rowsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1511 | this, "1""_q_sourceRowsAboutToBeInserted(QModelIndex,int,int)"); | - |
| 1512 | | - |
| 1513 | connect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
| 1514 | this, "1""_q_sourceRowsInserted(QModelIndex,int,int)"); | - |
| 1515 | | - |
| 1516 | connect(d->model, "2""columnsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1517 | this, "1""_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int)"); | - |
| 1518 | | - |
| 1519 | connect(d->model, "2""columnsInserted(QModelIndex,int,int)", | - |
| 1520 | this, "1""_q_sourceColumnsInserted(QModelIndex,int,int)"); | - |
| 1521 | | - |
| 1522 | connect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1523 | this, "1""_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int)"); | - |
| 1524 | | - |
| 1525 | connect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
| 1526 | this, "1""_q_sourceRowsRemoved(QModelIndex,int,int)"); | - |
| 1527 | | - |
| 1528 | connect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1529 | this, "1""_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int)"); | - |
| 1530 | | - |
| 1531 | connect(d->model, "2""columnsRemoved(QModelIndex,int,int)", | - |
| 1532 | this, "1""_q_sourceColumnsRemoved(QModelIndex,int,int)"); | - |
| 1533 | | - |
| 1534 | connect(d->model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1535 | this, "1""_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1536 | | - |
| 1537 | connect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1538 | this, "1""_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1539 | | - |
| 1540 | connect(d->model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1541 | this, "1""_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1542 | | - |
| 1543 | connect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
| 1544 | this, "1""_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
| 1545 | | - |
| 1546 | connect(d->model, "2""layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)", | - |
| 1547 | this, "1""_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)"); | - |
| 1548 | | - |
| 1549 | connect(d->model, "2""layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)", | - |
| 1550 | this, "1""_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)"); | - |
| 1551 | | - |
| 1552 | connect(d->model, "2""modelAboutToBeReset()", this, "1""_q_sourceAboutToBeReset()"); | - |
| 1553 | connect(d->model, "2""modelReset()", this, "1""_q_sourceReset()"); | - |
| 1554 | | - |
| 1555 | d->_q_clearMapping(); | - |
| 1556 | endResetModel(); | - |
| 1557 | if (d->update_source_sort_column() && d->dynamic_sortfilter) evaluated: d->update_source_sort_column()| yes Evaluation Count:1 | yes Evaluation Count:269 |
partially evaluated: d->dynamic_sortfilter| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-269 |
| 1558 | d->sort(); never executed: d->sort(); | 0 |
| 1559 | } executed: }Execution Count:270 | 270 |
| 1560 | | - |
| 1561 | | - |
| 1562 | | - |
| 1563 | | - |
| 1564 | QModelIndex QSortFilterProxyModel::index(int row, int column, const QModelIndex &parent) const | - |
| 1565 | { | - |
| 1566 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1567 | if (row < 0 || column < 0) evaluated: row < 0| yes Evaluation Count:145 | yes Evaluation Count:81098 |
evaluated: column < 0| yes Evaluation Count:2944 | yes Evaluation Count:78154 |
| 145-81098 |
| 1568 | return QModelIndex(); executed: return QModelIndex();Execution Count:3089 | 3089 |
| 1569 | | - |
| 1570 | QModelIndex source_parent = mapToSource(parent); | - |
| 1571 | IndexMap::const_iterator it = d->create_mapping(source_parent); | - |
| 1572 | if (it.value()->source_rows.count() <= row || it.value()->source_columns.count() <= column) evaluated: it.value()->source_rows.count() <= row| yes Evaluation Count:211 | yes Evaluation Count:77943 |
evaluated: it.value()->source_columns.count() <= column| yes Evaluation Count:49 | yes Evaluation Count:77894 |
| 49-77943 |
| 1573 | return QModelIndex(); executed: return QModelIndex();Execution Count:260 | 260 |
| 1574 | | - |
| 1575 | return d->create_index(row, column, it); executed: return d->create_index(row, column, it);Execution Count:77894 | 77894 |
| 1576 | } | - |
| 1577 | | - |
| 1578 | | - |
| 1579 | | - |
| 1580 | | - |
| 1581 | QModelIndex QSortFilterProxyModel::parent(const QModelIndex &child) const | - |
| 1582 | { | - |
| 1583 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1584 | if (!d->indexValid(child)) evaluated: !d->indexValid(child)| yes Evaluation Count:123 | yes Evaluation Count:16146 |
| 123-16146 |
| 1585 | return QModelIndex(); executed: return QModelIndex();Execution Count:123 | 123 |
| 1586 | IndexMap::const_iterator it = d->index_to_iterator(child); | - |
| 1587 | qt_noop(); | - |
| 1588 | QModelIndex source_parent = it.key(); | - |
| 1589 | QModelIndex proxy_parent = mapFromSource(source_parent); | - |
| 1590 | return proxy_parent; executed: return proxy_parent;Execution Count:16146 | 16146 |
| 1591 | } | - |
| 1592 | | - |
| 1593 | | - |
| 1594 | | - |
| 1595 | | - |
| 1596 | QModelIndex QSortFilterProxyModel::sibling(int row, int column, const QModelIndex &idx) const | - |
| 1597 | { | - |
| 1598 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1599 | if (!d->indexValid(idx)) evaluated: !d->indexValid(idx)| yes Evaluation Count:41 | yes Evaluation Count:16736 |
| 41-16736 |
| 1600 | return QModelIndex(); executed: return QModelIndex();Execution Count:41 | 41 |
| 1601 | | - |
| 1602 | const IndexMap::const_iterator it = d->index_to_iterator(idx); | - |
| 1603 | if (it.value()->source_rows.count() <= row || it.value()->source_columns.count() <= column) partially evaluated: it.value()->source_rows.count() <= row| no Evaluation Count:0 | yes Evaluation Count:16736 |
partially evaluated: it.value()->source_columns.count() <= column| no Evaluation Count:0 | yes Evaluation Count:16736 |
| 0-16736 |
| 1604 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
| 1605 | | - |
| 1606 | return d->create_index(row, column, it); executed: return d->create_index(row, column, it);Execution Count:16736 | 16736 |
| 1607 | } | - |
| 1608 | | - |
| 1609 | | - |
| 1610 | | - |
| 1611 | | - |
| 1612 | int QSortFilterProxyModel::rowCount(const QModelIndex &parent) const | - |
| 1613 | { | - |
| 1614 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1615 | QModelIndex source_parent = mapToSource(parent); | - |
| 1616 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:6589 | yes Evaluation Count:38485 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:6589 |
| 0-38485 |
| 1617 | return 0; never executed: return 0; | 0 |
| 1618 | IndexMap::const_iterator it = d->create_mapping(source_parent); | - |
| 1619 | return it.value()->source_rows.count(); executed: return it.value()->source_rows.count();Execution Count:45074 | 45074 |
| 1620 | } | - |
| 1621 | | - |
| 1622 | | - |
| 1623 | | - |
| 1624 | | - |
| 1625 | int QSortFilterProxyModel::columnCount(const QModelIndex &parent) const | - |
| 1626 | { | - |
| 1627 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1628 | QModelIndex source_parent = mapToSource(parent); | - |
| 1629 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:6362 | yes Evaluation Count:4337 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:6362 |
| 0-6362 |
| 1630 | return 0; never executed: return 0; | 0 |
| 1631 | IndexMap::const_iterator it = d->create_mapping(source_parent); | - |
| 1632 | return it.value()->source_columns.count(); executed: return it.value()->source_columns.count();Execution Count:10699 | 10699 |
| 1633 | } | - |
| 1634 | | - |
| 1635 | | - |
| 1636 | | - |
| 1637 | | - |
| 1638 | bool QSortFilterProxyModel::hasChildren(const QModelIndex &parent) const | - |
| 1639 | { | - |
| 1640 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1641 | QModelIndex source_parent = mapToSource(parent); | - |
| 1642 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:8516 | yes Evaluation Count:302 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:8516 |
| 0-8516 |
| 1643 | return false; never executed: return false; | 0 |
| 1644 | if (!d->model->hasChildren(source_parent)) evaluated: !d->model->hasChildren(source_parent)| yes Evaluation Count:8305 | yes Evaluation Count:513 |
| 513-8305 |
| 1645 | return false; executed: return false;Execution Count:8305 | 8305 |
| 1646 | | - |
| 1647 | if (d->model->canFetchMore(source_parent)) evaluated: d->model->canFetchMore(source_parent)| yes Evaluation Count:2 | yes Evaluation Count:511 |
| 2-511 |
| 1648 | return true; executed: return true;Execution Count:2 | 2 |
| 1649 | | - |
| 1650 | QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); | - |
| 1651 | return m->source_rows.count() != 0 && m->source_columns.count() != 0; executed: return m->source_rows.count() != 0 && m->source_columns.count() != 0;Execution Count:511 | 511 |
| 1652 | } | - |
| 1653 | | - |
| 1654 | | - |
| 1655 | | - |
| 1656 | | - |
| 1657 | QVariant QSortFilterProxyModel::data(const QModelIndex &index, int role) const | - |
| 1658 | { | - |
| 1659 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1660 | QModelIndex source_index = mapToSource(index); | - |
| 1661 | if (index.isValid() && !source_index.isValid()) evaluated: index.isValid()| yes Evaluation Count:41856 | yes Evaluation Count:102 |
partially evaluated: !source_index.isValid()| no Evaluation Count:0 | yes Evaluation Count:41856 |
| 0-41856 |
| 1662 | return QVariant(); never executed: return QVariant(); | 0 |
| 1663 | return d->model->data(source_index, role); executed: return d->model->data(source_index, role);Execution Count:41958 | 41958 |
| 1664 | } | - |
| 1665 | | - |
| 1666 | | - |
| 1667 | | - |
| 1668 | | - |
| 1669 | bool QSortFilterProxyModel::setData(const QModelIndex &index, const QVariant &value, int role) | - |
| 1670 | { | - |
| 1671 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1672 | QModelIndex source_index = mapToSource(index); | - |
| 1673 | if (index.isValid() && !source_index.isValid()) evaluated: index.isValid()| yes Evaluation Count:6065 | yes Evaluation Count:77 |
partially evaluated: !source_index.isValid()| no Evaluation Count:0 | yes Evaluation Count:6065 |
| 0-6065 |
| 1674 | return false; never executed: return false; | 0 |
| 1675 | return d->model->setData(source_index, value, role); executed: return d->model->setData(source_index, value, role);Execution Count:6142 | 6142 |
| 1676 | } | - |
| 1677 | | - |
| 1678 | | - |
| 1679 | | - |
| 1680 | | - |
| 1681 | QVariant QSortFilterProxyModel::headerData(int section, Qt::Orientation orientation, int role) const | - |
| 1682 | { | - |
| 1683 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1684 | IndexMap::const_iterator it = d->create_mapping(QModelIndex()); | - |
| 1685 | if (it.value()->source_rows.count() * it.value()->source_columns.count() > 0) evaluated: it.value()->source_rows.count() * it.value()->source_columns.count() > 0| yes Evaluation Count:2068 | yes Evaluation Count:53 |
| 53-2068 |
| 1686 | return QAbstractProxyModel::headerData(section, orientation, role); executed: return QAbstractProxyModel::headerData(section, orientation, role);Execution Count:2068 | 2068 |
| 1687 | int source_section; | - |
| 1688 | if (orientation == Qt::Vertical) { partially evaluated: orientation == Qt::Vertical| no Evaluation Count:0 | yes Evaluation Count:53 |
| 0-53 |
| 1689 | if (section < 0 || section >= it.value()->source_rows.count()) never evaluated: section < 0 never evaluated: section >= it.value()->source_rows.count() | 0 |
| 1690 | return QVariant(); never executed: return QVariant(); | 0 |
| 1691 | source_section = it.value()->source_rows.at(section); | - |
| 1692 | } else { | 0 |
| 1693 | if (section < 0 || section >= it.value()->source_columns.count()) partially evaluated: section < 0| no Evaluation Count:0 | yes Evaluation Count:53 |
evaluated: section >= it.value()->source_columns.count()| yes Evaluation Count:5 | yes Evaluation Count:48 |
| 0-53 |
| 1694 | return QVariant(); executed: return QVariant();Execution Count:5 | 5 |
| 1695 | source_section = it.value()->source_columns.at(section); | - |
| 1696 | } executed: }Execution Count:48 | 48 |
| 1697 | return d->model->headerData(source_section, orientation, role); executed: return d->model->headerData(source_section, orientation, role);Execution Count:48 | 48 |
| 1698 | } | - |
| 1699 | | - |
| 1700 | | - |
| 1701 | | - |
| 1702 | | - |
| 1703 | bool QSortFilterProxyModel::setHeaderData(int section, Qt::Orientation orientation, | - |
| 1704 | const QVariant &value, int role) | - |
| 1705 | { | - |
| 1706 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1707 | IndexMap::const_iterator it = d->create_mapping(QModelIndex()); | - |
| 1708 | if (it.value()->source_rows.count() * it.value()->source_columns.count() > 0) evaluated: it.value()->source_rows.count() * it.value()->source_columns.count() > 0| yes Evaluation Count:88 | yes Evaluation Count:19 |
| 19-88 |
| 1709 | return QAbstractProxyModel::setHeaderData(section, orientation, value, role); executed: return QAbstractProxyModel::setHeaderData(section, orientation, value, role);Execution Count:88 | 88 |
| 1710 | int source_section; | - |
| 1711 | if (orientation == Qt::Vertical) { evaluated: orientation == Qt::Vertical| yes Evaluation Count:1 | yes Evaluation Count:18 |
| 1-18 |
| 1712 | if (section < 0 || section >= it.value()->source_rows.count()) partially evaluated: section < 0| yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: section >= it.value()->source_rows.count() | 0-1 |
| 1713 | return false; executed: return false;Execution Count:1 | 1 |
| 1714 | source_section = it.value()->source_rows.at(section); | - |
| 1715 | } else { | 0 |
| 1716 | if (section < 0 || section >= it.value()->source_columns.count()) evaluated: section < 0| yes Evaluation Count:9 | yes Evaluation Count:9 |
partially evaluated: section >= it.value()->source_columns.count()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 1717 | return false; executed: return false;Execution Count:18 | 18 |
| 1718 | source_section = it.value()->source_columns.at(section); | - |
| 1719 | } | 0 |
| 1720 | return d->model->setHeaderData(source_section, orientation, value, role); never executed: return d->model->setHeaderData(source_section, orientation, value, role); | 0 |
| 1721 | } | - |
| 1722 | | - |
| 1723 | | - |
| 1724 | | - |
| 1725 | | - |
| 1726 | QMimeData *QSortFilterProxyModel::mimeData(const QModelIndexList &indexes) const | - |
| 1727 | { | - |
| 1728 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1729 | QModelIndexList source_indexes; | - |
| 1730 | for (int i = 0; i < indexes.count(); ++i) never evaluated: i < indexes.count() | 0 |
| 1731 | source_indexes << mapToSource(indexes.at(i)); never executed: source_indexes << mapToSource(indexes.at(i)); | 0 |
| 1732 | return d->model->mimeData(source_indexes); never executed: return d->model->mimeData(source_indexes); | 0 |
| 1733 | } | - |
| 1734 | | - |
| 1735 | | - |
| 1736 | | - |
| 1737 | | - |
| 1738 | QStringList QSortFilterProxyModel::mimeTypes() const | - |
| 1739 | { | - |
| 1740 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1741 | return d->model->mimeTypes(); executed: return d->model->mimeTypes();Execution Count:41 | 41 |
| 1742 | } | - |
| 1743 | | - |
| 1744 | | - |
| 1745 | | - |
| 1746 | | - |
| 1747 | Qt::DropActions QSortFilterProxyModel::supportedDropActions() const | - |
| 1748 | { | - |
| 1749 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1750 | return d->model->supportedDropActions(); executed: return d->model->supportedDropActions();Execution Count:41 | 41 |
| 1751 | } | - |
| 1752 | | - |
| 1753 | | - |
| 1754 | | - |
| 1755 | | - |
| 1756 | bool QSortFilterProxyModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - |
| 1757 | int row, int column, const QModelIndex &parent) | - |
| 1758 | { | - |
| 1759 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1760 | if ((row == -1) && (column == -1)) never evaluated: (row == -1) never evaluated: (column == -1) | 0 |
| 1761 | return d->model->dropMimeData(data, action, -1, -1, mapToSource(parent)); never executed: return d->model->dropMimeData(data, action, -1, -1, mapToSource(parent)); | 0 |
| 1762 | int source_destination_row = -1; | - |
| 1763 | int source_destination_column = -1; | - |
| 1764 | QModelIndex source_parent; | - |
| 1765 | if (row == rowCount(parent)) { never evaluated: row == rowCount(parent) | 0 |
| 1766 | source_parent = mapToSource(parent); | - |
| 1767 | source_destination_row = d->model->rowCount(source_parent); | - |
| 1768 | } else { | 0 |
| 1769 | QModelIndex proxy_index = index(row, column, parent); | - |
| 1770 | QModelIndex source_index = mapToSource(proxy_index); | - |
| 1771 | source_destination_row = source_index.row(); | - |
| 1772 | source_destination_column = source_index.column(); | - |
| 1773 | source_parent = source_index.parent(); | - |
| 1774 | } | 0 |
| 1775 | return d->model->dropMimeData(data, action, source_destination_row, | 0 |
| 1776 | source_destination_column, source_parent); never executed: return d->model->dropMimeData(data, action, source_destination_row, source_destination_column, source_parent); | 0 |
| 1777 | } | - |
| 1778 | | - |
| 1779 | | - |
| 1780 | | - |
| 1781 | | - |
| 1782 | bool QSortFilterProxyModel::insertRows(int row, int count, const QModelIndex &parent) | - |
| 1783 | { | - |
| 1784 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1785 | if (row < 0 || count <= 0) evaluated: row < 0| yes Evaluation Count:9 | yes Evaluation Count:51 |
evaluated: count <= 0| yes Evaluation Count:21 | yes Evaluation Count:30 |
| 9-51 |
| 1786 | return false; executed: return false;Execution Count:30 | 30 |
| 1787 | QModelIndex source_parent = mapToSource(parent); | - |
| 1788 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:27 | yes Evaluation Count:3 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 1789 | return false; never executed: return false; | 0 |
| 1790 | QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); | - |
| 1791 | if (row > m->source_rows.count()) evaluated: row > m->source_rows.count()| yes Evaluation Count:6 | yes Evaluation Count:24 |
| 6-24 |
| 1792 | return false; executed: return false;Execution Count:6 | 6 |
| 1793 | int source_row = (row >= m->source_rows.count() evaluated: row >= m->source_rows.count()| yes Evaluation Count:1 | yes Evaluation Count:23 |
| 1-23 |
| 1794 | ? m->source_rows.count() | - |
| 1795 | : m->source_rows.at(row)); | - |
| 1796 | return d->model->insertRows(source_row, count, source_parent); executed: return d->model->insertRows(source_row, count, source_parent);Execution Count:24 | 24 |
| 1797 | } | - |
| 1798 | | - |
| 1799 | | - |
| 1800 | | - |
| 1801 | | - |
| 1802 | bool QSortFilterProxyModel::insertColumns(int column, int count, const QModelIndex &parent) | - |
| 1803 | { | - |
| 1804 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1805 | if (column < 0|| count <= 0) evaluated: column < 0| yes Evaluation Count:9 | yes Evaluation Count:48 |
evaluated: count <= 0| yes Evaluation Count:21 | yes Evaluation Count:27 |
| 9-48 |
| 1806 | return false; executed: return false;Execution Count:30 | 30 |
| 1807 | QModelIndex source_parent = mapToSource(parent); | - |
| 1808 | if (parent.isValid() && !source_parent.isValid()) partially evaluated: parent.isValid()| yes Evaluation Count:27 | no Evaluation Count:0 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:27 |
| 0-27 |
| 1809 | return false; never executed: return false; | 0 |
| 1810 | QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); | - |
| 1811 | if (column > m->source_columns.count()) evaluated: column > m->source_columns.count()| yes Evaluation Count:6 | yes Evaluation Count:21 |
| 6-21 |
| 1812 | return false; executed: return false;Execution Count:6 | 6 |
| 1813 | int source_column = (column >= m->source_columns.count() partially evaluated: column >= m->source_columns.count()| no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
| 1814 | ? m->source_columns.count() | - |
| 1815 | : m->source_columns.at(column)); | - |
| 1816 | return d->model->insertColumns(source_column, count, source_parent); executed: return d->model->insertColumns(source_column, count, source_parent);Execution Count:21 | 21 |
| 1817 | } | - |
| 1818 | | - |
| 1819 | | - |
| 1820 | | - |
| 1821 | | - |
| 1822 | bool QSortFilterProxyModel::removeRows(int row, int count, const QModelIndex &parent) | - |
| 1823 | { | - |
| 1824 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1825 | if (row < 0 || count <= 0) evaluated: row < 0| yes Evaluation Count:13 | yes Evaluation Count:65 |
evaluated: count <= 0| yes Evaluation Count:21 | yes Evaluation Count:44 |
| 13-65 |
| 1826 | return false; executed: return false;Execution Count:34 | 34 |
| 1827 | QModelIndex source_parent = mapToSource(parent); | - |
| 1828 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:33 | yes Evaluation Count:11 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
| 1829 | return false; never executed: return false; | 0 |
| 1830 | QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); | - |
| 1831 | if (row + count > m->source_rows.count()) evaluated: row + count > m->source_rows.count()| yes Evaluation Count:13 | yes Evaluation Count:31 |
| 13-31 |
| 1832 | return false; executed: return false;Execution Count:13 | 13 |
| 1833 | if ((count == 1) evaluated: (count == 1)| yes Evaluation Count:14 | yes Evaluation Count:17 |
| 14-17 |
| 1834 | || ((d->source_sort_column < 0) && (m->proxy_rows.count() == m->source_rows.count()))) { evaluated: (d->source_sort_column < 0)| yes Evaluation Count:14 | yes Evaluation Count:3 |
partially evaluated: (m->proxy_rows.count() == m->source_rows.count())| yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
| 1835 | int source_row = m->source_rows.at(row); | - |
| 1836 | return d->model->removeRows(source_row, count, source_parent); executed: return d->model->removeRows(source_row, count, source_parent);Execution Count:28 | 28 |
| 1837 | } | - |
| 1838 | | - |
| 1839 | | - |
| 1840 | QVector<int> rows; | - |
| 1841 | for (int i = row; i < row + count; ++i) evaluated: i < row + count| yes Evaluation Count:9 | yes Evaluation Count:3 |
| 3-9 |
| 1842 | rows.append(m->source_rows.at(i)); executed: rows.append(m->source_rows.at(i));Execution Count:9 | 9 |
| 1843 | std::sort(rows.begin(), rows.end()); | - |
| 1844 | | - |
| 1845 | int pos = rows.count() - 1; | - |
| 1846 | bool ok = true; | - |
| 1847 | while (pos >= 0) { evaluated: pos >= 0| yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
| 1848 | const int source_end = rows.at(pos--); | - |
| 1849 | int source_start = source_end; | - |
| 1850 | while ((pos >= 0) && (rows.at(pos) == (source_start - 1))) { evaluated: (pos >= 0)| yes Evaluation Count:6 | yes Evaluation Count:3 |
evaluated: (rows.at(pos) == (source_start - 1))| yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-6 |
| 1851 | --source_start; | - |
| 1852 | --pos; | - |
| 1853 | } executed: }Execution Count:5 | 5 |
| 1854 | ok = ok && d->model->removeRows(source_start, source_end - source_start + 1, partially evaluated: ok| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 1855 | source_parent); partially evaluated: d->model->removeRows(source_start, source_end - source_start + 1, source_parent)| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 1856 | } executed: }Execution Count:4 | 4 |
| 1857 | return ok; executed: return ok;Execution Count:3 | 3 |
| 1858 | } | - |
| 1859 | | - |
| 1860 | | - |
| 1861 | | - |
| 1862 | | - |
| 1863 | bool QSortFilterProxyModel::removeColumns(int column, int count, const QModelIndex &parent) | - |
| 1864 | { | - |
| 1865 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1866 | if (column < 0 || count <= 0) evaluated: column < 0| yes Evaluation Count:13 | yes Evaluation Count:62 |
evaluated: count <= 0| yes Evaluation Count:21 | yes Evaluation Count:41 |
| 13-62 |
| 1867 | return false; executed: return false;Execution Count:34 | 34 |
| 1868 | QModelIndex source_parent = mapToSource(parent); | - |
| 1869 | if (parent.isValid() && !source_parent.isValid()) evaluated: parent.isValid()| yes Evaluation Count:33 | yes Evaluation Count:8 |
partially evaluated: !source_parent.isValid()| no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
| 1870 | return false; never executed: return false; | 0 |
| 1871 | QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value(); | - |
| 1872 | if (column + count > m->source_columns.count()) evaluated: column + count > m->source_columns.count()| yes Evaluation Count:14 | yes Evaluation Count:27 |
| 14-27 |
| 1873 | return false; executed: return false;Execution Count:14 | 14 |
| 1874 | if ((count == 1) || (m->proxy_columns.count() == m->source_columns.count())) { evaluated: (count == 1)| yes Evaluation Count:13 | yes Evaluation Count:14 |
evaluated: (m->proxy_columns.count() == m->source_columns.count())| yes Evaluation Count:13 | yes Evaluation Count:1 |
| 1-14 |
| 1875 | int source_column = m->source_columns.at(column); | - |
| 1876 | return d->model->removeColumns(source_column, count, source_parent); executed: return d->model->removeColumns(source_column, count, source_parent);Execution Count:26 | 26 |
| 1877 | } | - |
| 1878 | | - |
| 1879 | QVector<int> columns; | - |
| 1880 | for (int i = column; i < column + count; ++i) evaluated: i < column + count| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 1881 | columns.append(m->source_columns.at(i)); executed: columns.append(m->source_columns.at(i));Execution Count:3 | 3 |
| 1882 | | - |
| 1883 | int pos = columns.count() - 1; | - |
| 1884 | bool ok = true; | - |
| 1885 | while (pos >= 0) { evaluated: pos >= 0| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 1886 | const int source_end = columns.at(pos--); | - |
| 1887 | int source_start = source_end; | - |
| 1888 | while ((pos >= 0) && (columns.at(pos) == (source_start - 1))) { evaluated: (pos >= 0)| yes Evaluation Count:2 | yes Evaluation Count:1 |
partially evaluated: (columns.at(pos) == (source_start - 1))| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1889 | --source_start; | - |
| 1890 | --pos; | - |
| 1891 | } | 0 |
| 1892 | ok = ok && d->model->removeColumns(source_start, source_end - source_start + 1, partially evaluated: ok| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 1893 | source_parent); partially evaluated: d->model->removeColumns(source_start, source_end - source_start + 1, source_parent)| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 1894 | } executed: }Execution Count:3 | 3 |
| 1895 | return ok; executed: return ok;Execution Count:1 | 1 |
| 1896 | } | - |
| 1897 | | - |
| 1898 | | - |
| 1899 | | - |
| 1900 | | - |
| 1901 | void QSortFilterProxyModel::fetchMore(const QModelIndex &parent) | - |
| 1902 | { | - |
| 1903 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1904 | QModelIndex source_parent; | - |
| 1905 | if (d->indexValid(parent)) evaluated: d->indexValid(parent)| yes Evaluation Count:1 | yes Evaluation Count:43 |
| 1-43 |
| 1906 | source_parent = mapToSource(parent); executed: source_parent = mapToSource(parent);Execution Count:1 | 1 |
| 1907 | d->model->fetchMore(source_parent); | - |
| 1908 | } executed: }Execution Count:44 | 44 |
| 1909 | | - |
| 1910 | | - |
| 1911 | | - |
| 1912 | | - |
| 1913 | bool QSortFilterProxyModel::canFetchMore(const QModelIndex &parent) const | - |
| 1914 | { | - |
| 1915 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1916 | QModelIndex source_parent; | - |
| 1917 | if (d->indexValid(parent)) evaluated: d->indexValid(parent)| yes Evaluation Count:214 | yes Evaluation Count:403 |
| 214-403 |
| 1918 | source_parent = mapToSource(parent); executed: source_parent = mapToSource(parent);Execution Count:214 | 214 |
| 1919 | return d->model->canFetchMore(source_parent); executed: return d->model->canFetchMore(source_parent);Execution Count:617 | 617 |
| 1920 | } | - |
| 1921 | | - |
| 1922 | | - |
| 1923 | | - |
| 1924 | | - |
| 1925 | Qt::ItemFlags QSortFilterProxyModel::flags(const QModelIndex &index) const | - |
| 1926 | { | - |
| 1927 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1928 | QModelIndex source_index; | - |
| 1929 | if (d->indexValid(index)) evaluated: d->indexValid(index)| yes Evaluation Count:1663 | yes Evaluation Count:41 |
| 41-1663 |
| 1930 | source_index = mapToSource(index); executed: source_index = mapToSource(index);Execution Count:1663 | 1663 |
| 1931 | return d->model->flags(source_index); executed: return d->model->flags(source_index);Execution Count:1704 | 1704 |
| 1932 | } | - |
| 1933 | | - |
| 1934 | | - |
| 1935 | | - |
| 1936 | | - |
| 1937 | QModelIndex QSortFilterProxyModel::buddy(const QModelIndex &index) const | - |
| 1938 | { | - |
| 1939 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1940 | if (!d->indexValid(index)) evaluated: !d->indexValid(index)| yes Evaluation Count:41 | yes Evaluation Count:31 |
| 31-41 |
| 1941 | return QModelIndex(); executed: return QModelIndex();Execution Count:41 | 41 |
| 1942 | QModelIndex source_index = mapToSource(index); | - |
| 1943 | QModelIndex source_buddy = d->model->buddy(source_index); | - |
| 1944 | if (source_index == source_buddy) partially evaluated: source_index == source_buddy| yes Evaluation Count:31 | no Evaluation Count:0 |
| 0-31 |
| 1945 | return index; executed: return index;Execution Count:31 | 31 |
| 1946 | return mapFromSource(source_buddy); never executed: return mapFromSource(source_buddy); | 0 |
| 1947 | } | - |
| 1948 | | - |
| 1949 | | - |
| 1950 | | - |
| 1951 | | - |
| 1952 | QModelIndexList QSortFilterProxyModel::match(const QModelIndex &start, int role, | - |
| 1953 | const QVariant &value, int hits, | - |
| 1954 | Qt::MatchFlags flags) const | - |
| 1955 | { | - |
| 1956 | return QAbstractProxyModel::match(start, role, value, hits, flags); executed: return QAbstractProxyModel::match(start, role, value, hits, flags);Execution Count:47 | 47 |
| 1957 | } | - |
| 1958 | | - |
| 1959 | | - |
| 1960 | | - |
| 1961 | | - |
| 1962 | QSize QSortFilterProxyModel::span(const QModelIndex &index) const | - |
| 1963 | { | - |
| 1964 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1965 | QModelIndex source_index = mapToSource(index); | - |
| 1966 | if (index.isValid() && !source_index.isValid()) partially evaluated: index.isValid()| no Evaluation Count:0 | yes Evaluation Count:41 |
never evaluated: !source_index.isValid() | 0-41 |
| 1967 | return QSize(); never executed: return QSize(); | 0 |
| 1968 | return d->model->span(source_index); executed: return d->model->span(source_index);Execution Count:41 | 41 |
| 1969 | } | - |
| 1970 | | - |
| 1971 | | - |
| 1972 | | - |
| 1973 | | - |
| 1974 | void QSortFilterProxyModel::sort(int column, Qt::SortOrder order) | - |
| 1975 | { | - |
| 1976 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1977 | if (d->dynamic_sortfilter && d->proxy_sort_column == column && d->sort_order == order) evaluated: d->dynamic_sortfilter| yes Evaluation Count:192 | yes Evaluation Count:5 |
evaluated: d->proxy_sort_column == column| yes Evaluation Count:108 | yes Evaluation Count:84 |
evaluated: d->sort_order == order| yes Evaluation Count:106 | yes Evaluation Count:2 |
| 2-192 |
| 1978 | return; executed: return;Execution Count:106 | 106 |
| 1979 | d->sort_order = order; | - |
| 1980 | d->proxy_sort_column = column; | - |
| 1981 | d->update_source_sort_column(); | - |
| 1982 | d->sort(); | - |
| 1983 | } executed: }Execution Count:91 | 91 |
| 1984 | | - |
| 1985 | | - |
| 1986 | | - |
| 1987 | | - |
| 1988 | | - |
| 1989 | | - |
| 1990 | | - |
| 1991 | int QSortFilterProxyModel::sortColumn() const | - |
| 1992 | { | - |
| 1993 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 1994 | return d->proxy_sort_column; executed: return d->proxy_sort_column;Execution Count:13 | 13 |
| 1995 | } | - |
| 1996 | | - |
| 1997 | | - |
| 1998 | | - |
| 1999 | | - |
| 2000 | | - |
| 2001 | | - |
| 2002 | | - |
| 2003 | Qt::SortOrder QSortFilterProxyModel::sortOrder() const | - |
| 2004 | { | - |
| 2005 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2006 | return d->sort_order; never executed: return d->sort_order; | 0 |
| 2007 | } | - |
| 2008 | QRegExp QSortFilterProxyModel::filterRegExp() const | - |
| 2009 | { | - |
| 2010 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2011 | return d->filter_regexp; executed: return d->filter_regexp;Execution Count:45 | 45 |
| 2012 | } | - |
| 2013 | | - |
| 2014 | void QSortFilterProxyModel::setFilterRegExp(const QRegExp ®Exp) | - |
| 2015 | { | - |
| 2016 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2017 | d->filter_regexp = regExp; | - |
| 2018 | d->filter_changed(); | - |
| 2019 | } executed: }Execution Count:164 | 164 |
| 2020 | int QSortFilterProxyModel::filterKeyColumn() const | - |
| 2021 | { | - |
| 2022 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2023 | return d->filter_column; executed: return d->filter_column;Execution Count:3 | 3 |
| 2024 | } | - |
| 2025 | | - |
| 2026 | void QSortFilterProxyModel::setFilterKeyColumn(int column) | - |
| 2027 | { | - |
| 2028 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2029 | d->filter_column = column; | - |
| 2030 | d->filter_changed(); | - |
| 2031 | } executed: }Execution Count:6 | 6 |
| 2032 | Qt::CaseSensitivity QSortFilterProxyModel::filterCaseSensitivity() const | - |
| 2033 | { | - |
| 2034 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2035 | return d->filter_regexp.caseSensitivity(); never executed: return d->filter_regexp.caseSensitivity(); | 0 |
| 2036 | } | - |
| 2037 | | - |
| 2038 | void QSortFilterProxyModel::setFilterCaseSensitivity(Qt::CaseSensitivity cs) | - |
| 2039 | { | - |
| 2040 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2041 | if (cs == d->filter_regexp.caseSensitivity()) never evaluated: cs == d->filter_regexp.caseSensitivity() | 0 |
| 2042 | return; | 0 |
| 2043 | d->filter_regexp.setCaseSensitivity(cs); | - |
| 2044 | d->filter_changed(); | - |
| 2045 | } | 0 |
| 2046 | Qt::CaseSensitivity QSortFilterProxyModel::sortCaseSensitivity() const | - |
| 2047 | { | - |
| 2048 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2049 | return d->sort_casesensitivity; never executed: return d->sort_casesensitivity; | 0 |
| 2050 | } | - |
| 2051 | | - |
| 2052 | void QSortFilterProxyModel::setSortCaseSensitivity(Qt::CaseSensitivity cs) | - |
| 2053 | { | - |
| 2054 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2055 | if (d->sort_casesensitivity == cs) evaluated: d->sort_casesensitivity == cs| yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
| 2056 | return; executed: return;Execution Count:3 | 3 |
| 2057 | | - |
| 2058 | d->sort_casesensitivity = cs; | - |
| 2059 | d->sort(); | - |
| 2060 | } executed: }Execution Count:3 | 3 |
| 2061 | bool QSortFilterProxyModel::isSortLocaleAware() const | - |
| 2062 | { | - |
| 2063 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2064 | return d->sort_localeaware; never executed: return d->sort_localeaware; | 0 |
| 2065 | } | - |
| 2066 | | - |
| 2067 | void QSortFilterProxyModel::setSortLocaleAware(bool on) | - |
| 2068 | { | - |
| 2069 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2070 | if (d->sort_localeaware == on) never evaluated: d->sort_localeaware == on | 0 |
| 2071 | return; | 0 |
| 2072 | | - |
| 2073 | d->sort_localeaware = on; | - |
| 2074 | d->sort(); | - |
| 2075 | } | 0 |
| 2076 | void QSortFilterProxyModel::setFilterRegExp(const QString &pattern) | - |
| 2077 | { | - |
| 2078 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2079 | d->filter_regexp.setPatternSyntax(QRegExp::RegExp); | - |
| 2080 | d->filter_regexp.setPattern(pattern); | - |
| 2081 | d->filter_changed(); | - |
| 2082 | } executed: }Execution Count:35 | 35 |
| 2083 | | - |
| 2084 | | - |
| 2085 | | - |
| 2086 | | - |
| 2087 | | - |
| 2088 | | - |
| 2089 | | - |
| 2090 | void QSortFilterProxyModel::setFilterWildcard(const QString &pattern) | - |
| 2091 | { | - |
| 2092 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2093 | d->filter_regexp.setPatternSyntax(QRegExp::Wildcard); | - |
| 2094 | d->filter_regexp.setPattern(pattern); | - |
| 2095 | d->filter_changed(); | - |
| 2096 | } | 0 |
| 2097 | | - |
| 2098 | | - |
| 2099 | | - |
| 2100 | | - |
| 2101 | | - |
| 2102 | | - |
| 2103 | | - |
| 2104 | void QSortFilterProxyModel::setFilterFixedString(const QString &pattern) | - |
| 2105 | { | - |
| 2106 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2107 | d->filter_regexp.setPatternSyntax(QRegExp::FixedString); | - |
| 2108 | d->filter_regexp.setPattern(pattern); | - |
| 2109 | d->filter_changed(); | - |
| 2110 | } | 0 |
| 2111 | bool QSortFilterProxyModel::dynamicSortFilter() const | - |
| 2112 | { | - |
| 2113 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2114 | return d->dynamic_sortfilter; never executed: return d->dynamic_sortfilter; | 0 |
| 2115 | } | - |
| 2116 | | - |
| 2117 | void QSortFilterProxyModel::setDynamicSortFilter(bool enable) | - |
| 2118 | { | - |
| 2119 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2120 | d->dynamic_sortfilter = enable; | - |
| 2121 | if (enable) evaluated: enable| yes Evaluation Count:22 | yes Evaluation Count:4 |
| 4-22 |
| 2122 | d->sort(); executed: d->sort();Execution Count:22 | 22 |
| 2123 | } executed: }Execution Count:26 | 26 |
| 2124 | int QSortFilterProxyModel::sortRole() const | - |
| 2125 | { | - |
| 2126 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2127 | return d->sort_role; never executed: return d->sort_role; | 0 |
| 2128 | } | - |
| 2129 | | - |
| 2130 | void QSortFilterProxyModel::setSortRole(int role) | - |
| 2131 | { | - |
| 2132 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2133 | if (d->sort_role == role) partially evaluated: d->sort_role == role| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2134 | return; | 0 |
| 2135 | d->sort_role = role; | - |
| 2136 | d->sort(); | - |
| 2137 | } executed: }Execution Count:1 | 1 |
| 2138 | int QSortFilterProxyModel::filterRole() const | - |
| 2139 | { | - |
| 2140 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2141 | return d->filter_role; never executed: return d->filter_role; | 0 |
| 2142 | } | - |
| 2143 | | - |
| 2144 | void QSortFilterProxyModel::setFilterRole(int role) | - |
| 2145 | { | - |
| 2146 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2147 | if (d->filter_role == role) partially evaluated: d->filter_role == role| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 2148 | return; | 0 |
| 2149 | d->filter_role = role; | - |
| 2150 | d->filter_changed(); | - |
| 2151 | } executed: }Execution Count:4 | 4 |
| 2152 | | - |
| 2153 | | - |
| 2154 | | - |
| 2155 | | - |
| 2156 | | - |
| 2157 | | - |
| 2158 | void QSortFilterProxyModel::clear() | - |
| 2159 | { | - |
| 2160 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2161 | layoutAboutToBeChanged(); | - |
| 2162 | d->_q_clearMapping(); | - |
| 2163 | layoutChanged(); | - |
| 2164 | } | 0 |
| 2165 | void QSortFilterProxyModel::invalidate() | - |
| 2166 | { | - |
| 2167 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2168 | layoutAboutToBeChanged(); | - |
| 2169 | d->_q_clearMapping(); | - |
| 2170 | layoutChanged(); | - |
| 2171 | } executed: }Execution Count:5 | 5 |
| 2172 | | - |
| 2173 | | - |
| 2174 | | - |
| 2175 | | - |
| 2176 | | - |
| 2177 | | - |
| 2178 | void QSortFilterProxyModel::filterChanged() | - |
| 2179 | { | - |
| 2180 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2181 | d->filter_changed(); | - |
| 2182 | } | 0 |
| 2183 | void QSortFilterProxyModel::invalidateFilter() | - |
| 2184 | { | - |
| 2185 | QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2186 | d->filter_changed(); | - |
| 2187 | } executed: }Execution Count:3 | 3 |
| 2188 | bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const | - |
| 2189 | { | - |
| 2190 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2191 | QVariant l = (left.model() ? left.model()->data(left, d->sort_role) : QVariant()); evaluated: left.model()| yes Evaluation Count:87285 | yes Evaluation Count:3 |
| 3-87285 |
| 2192 | QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant()); evaluated: right.model()| yes Evaluation Count:87285 | yes Evaluation Count:3 |
| 3-87285 |
| 2193 | switch (l.userType()) { | - |
| 2194 | case QVariant::Invalid: | - |
| 2195 | return (r.type() != QVariant::Invalid); executed: return (r.type() != QVariant::Invalid);Execution Count:12986 | 12986 |
| 2196 | case QVariant::Int: | - |
| 2197 | return l.toInt() < r.toInt(); executed: return l.toInt() < r.toInt();Execution Count:8 | 8 |
| 2198 | case QVariant::UInt: | - |
| 2199 | return l.toUInt() < r.toUInt(); never executed: return l.toUInt() < r.toUInt(); | 0 |
| 2200 | case QVariant::LongLong: | - |
| 2201 | return l.toLongLong() < r.toLongLong(); never executed: return l.toLongLong() < r.toLongLong(); | 0 |
| 2202 | case QVariant::ULongLong: | - |
| 2203 | return l.toULongLong() < r.toULongLong(); never executed: return l.toULongLong() < r.toULongLong(); | 0 |
| 2204 | case QMetaType::Float: | - |
| 2205 | return l.toFloat() < r.toFloat(); never executed: return l.toFloat() < r.toFloat(); | 0 |
| 2206 | case QVariant::Double: | - |
| 2207 | return l.toDouble() < r.toDouble(); never executed: return l.toDouble() < r.toDouble(); | 0 |
| 2208 | case QVariant::Char: | - |
| 2209 | return l.toChar() < r.toChar(); never executed: return l.toChar() < r.toChar(); | 0 |
| 2210 | case QVariant::Date: | - |
| 2211 | return l.toDate() < r.toDate(); never executed: return l.toDate() < r.toDate(); | 0 |
| 2212 | case QVariant::Time: | - |
| 2213 | return l.toTime() < r.toTime(); never executed: return l.toTime() < r.toTime(); | 0 |
| 2214 | case QVariant::DateTime: | - |
| 2215 | return l.toDateTime() < r.toDateTime(); never executed: return l.toDateTime() < r.toDateTime(); | 0 |
| 2216 | case QVariant::String: | - |
| 2217 | default: | - |
| 2218 | if (d->sort_localeaware) partially evaluated: d->sort_localeaware| no Evaluation Count:0 | yes Evaluation Count:74294 |
| 0-74294 |
| 2219 | return l.toString().localeAwareCompare(r.toString()) < 0; never executed: return l.toString().localeAwareCompare(r.toString()) < 0; | 0 |
| 2220 | else | - |
| 2221 | return l.toString().compare(r.toString(), d->sort_casesensitivity) < 0; executed: return l.toString().compare(r.toString(), d->sort_casesensitivity) < 0;Execution Count:74294 | 74294 |
| 2222 | } | - |
| 2223 | return false; never executed: return false; | 0 |
| 2224 | } | - |
| 2225 | bool QSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const | - |
| 2226 | { | - |
| 2227 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2228 | if (d->filter_regexp.isEmpty()) evaluated: d->filter_regexp.isEmpty()| yes Evaluation Count:45921 | yes Evaluation Count:23744 |
| 23744-45921 |
| 2229 | return true; executed: return true;Execution Count:45921 | 45921 |
| 2230 | if (d->filter_column == -1) { evaluated: d->filter_column == -1| yes Evaluation Count:5 | yes Evaluation Count:23739 |
| 5-23739 |
| 2231 | int column_count = d->model->columnCount(source_parent); | - |
| 2232 | for (int column = 0; column < column_count; ++column) { evaluated: column < column_count| yes Evaluation Count:11 | yes Evaluation Count:2 |
| 2-11 |
| 2233 | QModelIndex source_index = d->model->index(source_row, column, source_parent); | - |
| 2234 | QString key = d->model->data(source_index, d->filter_role).toString(); | - |
| 2235 | if (key.contains(d->filter_regexp)) evaluated: key.contains(d->filter_regexp)| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
| 2236 | return true; executed: return true;Execution Count:3 | 3 |
| 2237 | } executed: }Execution Count:8 | 8 |
| 2238 | return false; executed: return false;Execution Count:2 | 2 |
| 2239 | } | - |
| 2240 | QModelIndex source_index = d->model->index(source_row, d->filter_column, source_parent); | - |
| 2241 | if (!source_index.isValid()) evaluated: !source_index.isValid()| yes Evaluation Count:3696 | yes Evaluation Count:20043 |
| 3696-20043 |
| 2242 | return true; executed: return true;Execution Count:3696 | 3696 |
| 2243 | QString key = d->model->data(source_index, d->filter_role).toString(); | - |
| 2244 | return key.contains(d->filter_regexp); executed: return key.contains(d->filter_regexp);Execution Count:20043 | 20043 |
| 2245 | } | - |
| 2246 | bool QSortFilterProxyModel::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const | - |
| 2247 | { | - |
| 2248 | (void)source_column;; | - |
| 2249 | (void)source_parent;; | - |
| 2250 | return true; executed: return true;Execution Count:31900 | 31900 |
| 2251 | } | - |
| 2252 | | - |
| 2253 | | - |
| 2254 | | - |
| 2255 | | - |
| 2256 | | - |
| 2257 | | - |
| 2258 | | - |
| 2259 | QModelIndex QSortFilterProxyModel::mapToSource(const QModelIndex &proxyIndex) const | - |
| 2260 | { | - |
| 2261 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2262 | return d->proxy_to_source(proxyIndex); executed: return d->proxy_to_source(proxyIndex);Execution Count:198228 | 198228 |
| 2263 | } | - |
| 2264 | | - |
| 2265 | | - |
| 2266 | | - |
| 2267 | | - |
| 2268 | | - |
| 2269 | | - |
| 2270 | | - |
| 2271 | QModelIndex QSortFilterProxyModel::mapFromSource(const QModelIndex &sourceIndex) const | - |
| 2272 | { | - |
| 2273 | const QSortFilterProxyModelPrivate * const d = d_func(); | - |
| 2274 | return d->source_to_proxy(sourceIndex); executed: return d->source_to_proxy(sourceIndex);Execution Count:19041 | 19041 |
| 2275 | } | - |
| 2276 | | - |
| 2277 | | - |
| 2278 | | - |
| 2279 | | - |
| 2280 | QItemSelection QSortFilterProxyModel::mapSelectionToSource(const QItemSelection &proxySelection) const | - |
| 2281 | { | - |
| 2282 | return QAbstractProxyModel::mapSelectionToSource(proxySelection); never executed: return QAbstractProxyModel::mapSelectionToSource(proxySelection); | 0 |
| 2283 | } | - |
| 2284 | | - |
| 2285 | | - |
| 2286 | | - |
| 2287 | | - |
| 2288 | QItemSelection QSortFilterProxyModel::mapSelectionFromSource(const QItemSelection &sourceSelection) const | - |
| 2289 | { | - |
| 2290 | return QAbstractProxyModel::mapSelectionFromSource(sourceSelection); executed: return QAbstractProxyModel::mapSelectionFromSource(sourceSelection);Execution Count:1 | 1 |
| 2291 | } | - |
| 2292 | | - |
| 2293 | | - |
| 2294 | | - |
| 2295 | | - |
| 2296 | | - |
| 2297 | | - |
| 2298 | | - |
| 2299 | | - |
| 2300 | | - |
| | |