| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index) | - |
| 6 | { | - |
| 7 | qt_noop(); | - |
| 8 | QPersistentModelIndexData *d = 0; | - |
| 9 | QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model()); | - |
| 10 | QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes; | - |
| 11 | const QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = indexes.find(index); | - |
| 12 | if (it != indexes.end()) { evaluated: it != indexes.end()| yes Evaluation Count:79776 | yes Evaluation Count:25197 |
| 25197-79776 |
| 13 | d = (*it); | - |
| 14 | } else { executed: }Execution Count:79776 | 79776 |
| 15 | d = new QPersistentModelIndexData(index); | - |
| 16 | indexes.insert(index, d); | - |
| 17 | } executed: }Execution Count:25197 | 25197 |
| 18 | qt_noop(); | - |
| 19 | return d; executed: return d;Execution Count:104973 | 104973 |
| 20 | } | - |
| 21 | | - |
| 22 | void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data) | - |
| 23 | { | - |
| 24 | qt_noop(); | - |
| 25 | qt_noop(); | - |
| 26 | QAbstractItemModel *model = const_cast<QAbstractItemModel *>(data->model); | - |
| 27 | | - |
| 28 | if (model) { evaluated: model| yes Evaluation Count:22461 | yes Evaluation Count:2732 |
| 2732-22461 |
| 29 | QAbstractItemModelPrivate *p = model->d_func(); | - |
| 30 | qt_noop(); | - |
| 31 | p->removePersistentIndexData(data); | - |
| 32 | } executed: }Execution Count:22461 | 22461 |
| 33 | delete data; | - |
| 34 | } executed: }Execution Count:25193 | 25193 |
| 35 | QPersistentModelIndex::QPersistentModelIndex() | - |
| 36 | : d(0) | - |
| 37 | { | - |
| 38 | } executed: }Execution Count:46845 | 46845 |
| 39 | QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other) | - |
| 40 | : d(other.d) | - |
| 41 | { | - |
| 42 | if (d) d->ref.ref(); evaluated: d| yes Evaluation Count:80449 | yes Evaluation Count:1586 |
executed: d->ref.ref();Execution Count:80449 | 1586-80449 |
| 43 | } executed: }Execution Count:82035 | 82035 |
| 44 | | - |
| 45 | | - |
| 46 | | - |
| 47 | | - |
| 48 | | - |
| 49 | QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index) | - |
| 50 | : d(0) | - |
| 51 | { | - |
| 52 | if (index.isValid()) { evaluated: index.isValid()| yes Evaluation Count:80276 | yes Evaluation Count:478 |
| 478-80276 |
| 53 | d = QPersistentModelIndexData::create(index); | - |
| 54 | d->ref.ref(); | - |
| 55 | } executed: }Execution Count:80276 | 80276 |
| 56 | } executed: }Execution Count:80754 | 80754 |
| 57 | | - |
| 58 | | - |
| 59 | | - |
| 60 | | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | QPersistentModelIndex::~QPersistentModelIndex() | - |
| 65 | { | - |
| 66 | if (d && !d->ref.deref()) { evaluated: d| yes Evaluation Count:183434 | yes Evaluation Count:22466 |
evaluated: !d->ref.deref()| yes Evaluation Count:17032 | yes Evaluation Count:166402 |
| 17032-183434 |
| 67 | QPersistentModelIndexData::destroy(d); | - |
| 68 | d = 0; | - |
| 69 | } executed: }Execution Count:17032 | 17032 |
| 70 | } executed: }Execution Count:205900 | 205900 |
| 71 | bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const | - |
| 72 | { | - |
| 73 | if (d && other.d) evaluated: d| yes Evaluation Count:45063 | yes Evaluation Count:551 |
evaluated: other.d| yes Evaluation Count:40743 | yes Evaluation Count:4320 |
| 551-45063 |
| 74 | return d->index == other.d->index; executed: return d->index == other.d->index;Execution Count:40743 | 40743 |
| 75 | return d == other.d; executed: return d == other.d;Execution Count:4871 | 4871 |
| 76 | } | - |
| 77 | bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const | - |
| 78 | { | - |
| 79 | if (d && other.d) partially evaluated: d| yes Evaluation Count:1511 | no Evaluation Count:0 |
partially evaluated: other.d| yes Evaluation Count:1511 | no Evaluation Count:0 |
| 0-1511 |
| 80 | return d->index < other.d->index; executed: return d->index < other.d->index;Execution Count:1511 | 1511 |
| 81 | | - |
| 82 | return d < other.d; never executed: return d < other.d; | 0 |
| 83 | } | - |
| 84 | QPersistentModelIndex &QPersistentModelIndex::operator=(const QPersistentModelIndex &other) | - |
| 85 | { | - |
| 86 | if (d == other.d) evaluated: d == other.d| yes Evaluation Count:5701 | yes Evaluation Count:15996 |
| 5701-15996 |
| 87 | return *this; executed: return *this;Execution Count:5701 | 5701 |
| 88 | if (d && !d->ref.deref()) evaluated: d| yes Evaluation Count:14352 | yes Evaluation Count:1644 |
evaluated: !d->ref.deref()| yes Evaluation Count:6751 | yes Evaluation Count:7601 |
| 1644-14352 |
| 89 | QPersistentModelIndexData::destroy(d); executed: QPersistentModelIndexData::destroy(d);Execution Count:6751 | 6751 |
| 90 | d = other.d; | - |
| 91 | if (d) d->ref.ref(); executed: d->ref.ref();Execution Count:15979 evaluated: d| yes Evaluation Count:15979 | yes Evaluation Count:17 |
| 17-15979 |
| 92 | return *this; executed: return *this;Execution Count:15996 | 15996 |
| 93 | } | - |
| 94 | QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other) | - |
| 95 | { | - |
| 96 | if (d && !d->ref.deref()) evaluated: d| yes Evaluation Count:3609 | yes Evaluation Count:36092 |
evaluated: !d->ref.deref()| yes Evaluation Count:1410 | yes Evaluation Count:2199 |
| 1410-36092 |
| 97 | QPersistentModelIndexData::destroy(d); executed: QPersistentModelIndexData::destroy(d);Execution Count:1410 | 1410 |
| 98 | if (other.isValid()) { evaluated: other.isValid()| yes Evaluation Count:24697 | yes Evaluation Count:15004 |
| 15004-24697 |
| 99 | d = QPersistentModelIndexData::create(other); | - |
| 100 | if (d) d->ref.ref(); executed: d->ref.ref();Execution Count:24697 partially evaluated: d| yes Evaluation Count:24697 | no Evaluation Count:0 |
| 0-24697 |
| 101 | } else { executed: }Execution Count:24697 | 24697 |
| 102 | d = 0; | - |
| 103 | } executed: }Execution Count:15004 | 15004 |
| 104 | return *this; executed: return *this;Execution Count:39701 | 39701 |
| 105 | } | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | | - |
| 111 | | - |
| 112 | | - |
| 113 | QPersistentModelIndex::operator const QModelIndex&() const | - |
| 114 | { | - |
| 115 | static const QModelIndex invalid; | - |
| 116 | if (d) evaluated: d| yes Evaluation Count:129164 | yes Evaluation Count:413968 |
| 129164-413968 |
| 117 | return d->index; executed: return d->index;Execution Count:129164 | 129164 |
| 118 | return invalid; executed: return invalid;Execution Count:413968 | 413968 |
| 119 | } | - |
| 120 | bool QPersistentModelIndex::operator==(const QModelIndex &other) const | - |
| 121 | { | - |
| 122 | if (d) evaluated: d| yes Evaluation Count:702 | yes Evaluation Count:584 |
| 584-702 |
| 123 | return d->index == other; executed: return d->index == other;Execution Count:702 | 702 |
| 124 | return !other.isValid(); executed: return !other.isValid();Execution Count:584 | 584 |
| 125 | } | - |
| 126 | bool QPersistentModelIndex::operator!=(const QModelIndex &other) const | - |
| 127 | { | - |
| 128 | if (d) partially evaluated: d| yes Evaluation Count:163 | no Evaluation Count:0 |
| 0-163 |
| 129 | return d->index != other; executed: return d->index != other;Execution Count:163 | 163 |
| 130 | return other.isValid(); never executed: return other.isValid(); | 0 |
| 131 | } | - |
| 132 | | - |
| 133 | | - |
| 134 | | - |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | | - |
| 139 | int QPersistentModelIndex::row() const | - |
| 140 | { | - |
| 141 | if (d) evaluated: d| yes Evaluation Count:227230 | yes Evaluation Count:2418 |
| 2418-227230 |
| 142 | return d->index.row(); executed: return d->index.row();Execution Count:227230 | 227230 |
| 143 | return -1; executed: return -1;Execution Count:2418 | 2418 |
| 144 | } | - |
| 145 | | - |
| 146 | | - |
| 147 | | - |
| 148 | | - |
| 149 | | - |
| 150 | | - |
| 151 | | - |
| 152 | int QPersistentModelIndex::column() const | - |
| 153 | { | - |
| 154 | if (d) evaluated: d| yes Evaluation Count:177108 | yes Evaluation Count:1719 |
| 1719-177108 |
| 155 | return d->index.column(); executed: return d->index.column();Execution Count:177108 | 177108 |
| 156 | return -1; executed: return -1;Execution Count:1719 | 1719 |
| 157 | } | - |
| 158 | void *QPersistentModelIndex::internalPointer() const | - |
| 159 | { | - |
| 160 | if (d) partially evaluated: d| yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
| 161 | return d->index.internalPointer(); executed: return d->index.internalPointer();Execution Count:89 | 89 |
| 162 | return 0; never executed: return 0; | 0 |
| 163 | } | - |
| 164 | quintptr QPersistentModelIndex::internalId() const | - |
| 165 | { | - |
| 166 | if (d) partially evaluated: d| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 167 | return d->index.internalId(); executed: return d->index.internalId();Execution Count:4 | 4 |
| 168 | return 0; never executed: return 0; | 0 |
| 169 | } | - |
| 170 | | - |
| 171 | | - |
| 172 | | - |
| 173 | | - |
| 174 | | - |
| 175 | | - |
| 176 | | - |
| 177 | QModelIndex QPersistentModelIndex::parent() const | - |
| 178 | { | - |
| 179 | if (d) evaluated: d| yes Evaluation Count:171723 | yes Evaluation Count:760 |
| 760-171723 |
| 180 | return d->index.parent(); executed: return d->index.parent();Execution Count:171723 | 171723 |
| 181 | return QModelIndex(); executed: return QModelIndex();Execution Count:760 | 760 |
| 182 | } | - |
| 183 | QModelIndex QPersistentModelIndex::sibling(int row, int column) const | - |
| 184 | { | - |
| 185 | if (d) partially evaluated: d| yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
| 186 | return d->index.sibling(row, column); executed: return d->index.sibling(row, column);Execution Count:8 | 8 |
| 187 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
| 188 | } | - |
| 189 | QModelIndex QPersistentModelIndex::child(int row, int column) const | - |
| 190 | { | - |
| 191 | if (d) | 0 |
| 192 | return d->index.child(row, column); never executed: return d->index.child(row, column); | 0 |
| 193 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
| 194 | } | - |
| 195 | | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | | - |
| 200 | | - |
| 201 | | - |
| 202 | QVariant QPersistentModelIndex::data(int role) const | - |
| 203 | { | - |
| 204 | if (d) partially evaluated: d| yes Evaluation Count:69 | no Evaluation Count:0 |
| 0-69 |
| 205 | return d->index.data(role); executed: return d->index.data(role);Execution Count:69 | 69 |
| 206 | return QVariant(); never executed: return QVariant(); | 0 |
| 207 | } | - |
| 208 | | - |
| 209 | | - |
| 210 | | - |
| 211 | | - |
| 212 | | - |
| 213 | | - |
| 214 | Qt::ItemFlags QPersistentModelIndex::flags() const | - |
| 215 | { | - |
| 216 | if (d) | 0 |
| 217 | return d->index.flags(); never executed: return d->index.flags(); | 0 |
| 218 | return 0; never executed: return 0; | 0 |
| 219 | } | - |
| 220 | | - |
| 221 | | - |
| 222 | | - |
| 223 | | - |
| 224 | const QAbstractItemModel *QPersistentModelIndex::model() const | - |
| 225 | { | - |
| 226 | if (d) partially evaluated: d| yes Evaluation Count:34614 | no Evaluation Count:0 |
| 0-34614 |
| 227 | return d->index.model(); executed: return d->index.model();Execution Count:34614 | 34614 |
| 228 | return 0; never executed: return 0; | 0 |
| 229 | } | - |
| 230 | bool QPersistentModelIndex::isValid() const | - |
| 231 | { | - |
| 232 | return d && d->index.isValid(); executed: return d && d->index.isValid();Execution Count:120046 | 120046 |
| 233 | } | - |
| 234 | | - |
| 235 | | - |
| 236 | QDebug operator<<(QDebug dbg, const QModelIndex &idx) | - |
| 237 | { | - |
| 238 | dbg.nospace() << "QModelIndex(" << idx.row() << ',' << idx.column() | - |
| 239 | << ',' << idx.internalPointer() << ',' << idx.model() << ')'; | - |
| 240 | return dbg.space(); executed: return dbg.space();Execution Count:13 | 13 |
| 241 | } | - |
| 242 | | - |
| 243 | QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx) | - |
| 244 | { | - |
| 245 | if (idx.d) | 0 |
| 246 | dbg << idx.d->index; never executed: dbg << idx.d->index; | 0 |
| 247 | else | - |
| 248 | dbg << QModelIndex(); never executed: dbg << QModelIndex(); | 0 |
| 249 | return dbg; never executed: return dbg; | 0 |
| 250 | } | - |
| 251 | | - |
| 252 | | - |
| 253 | class QEmptyItemModel : public QAbstractItemModel | - |
| 254 | { | - |
| 255 | public: | - |
| 256 | explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {} executed: }Execution Count:36 | 36 |
| 257 | QModelIndex index(int, int, const QModelIndex &) const { return QModelIndex(); } executed: return QModelIndex();Execution Count:23 | 23 |
| 258 | QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } never executed: return QModelIndex(); | 0 |
| 259 | int rowCount(const QModelIndex &) const { return 0; } executed: return 0;Execution Count:1341 | 1341 |
| 260 | int columnCount(const QModelIndex &) const { return 0; } executed: return 0;Execution Count:2229 | 2229 |
| 261 | bool hasChildren(const QModelIndex &) const { return false; } executed: return false;Execution Count:174 | 174 |
| 262 | QVariant data(const QModelIndex &, int) const { return QVariant(); } executed: return QVariant();Execution Count:1030 | 1030 |
| 263 | }; | - |
| 264 | | - |
| 265 | static QEmptyItemModel *qEmptyModel() { static QGlobalStatic<QEmptyItemModel > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QEmptyItemModel *x = new QEmptyItemModel; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QEmptyItemModel > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:36 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:36 | yes Evaluation Count:184000 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:36 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:184036 | 0-184036 |
| 266 | | - |
| 267 | QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel() | - |
| 268 | { | - |
| 269 | return qEmptyModel(); executed: return qEmptyModel();Execution Count:184036 | 184036 |
| 270 | } | - |
| 271 | | - |
| 272 | namespace { | - |
| 273 | struct DefaultRoleNames : public QHash<int, QByteArray> | - |
| 274 | { | - |
| 275 | DefaultRoleNames() { | - |
| 276 | (*this)[Qt::DisplayRole] = "display"; | - |
| 277 | (*this)[Qt::DecorationRole] = "decoration"; | - |
| 278 | (*this)[Qt::EditRole] = "edit"; | - |
| 279 | (*this)[Qt::ToolTipRole] = "toolTip"; | - |
| 280 | (*this)[Qt::StatusTipRole] = "statusTip"; | - |
| 281 | (*this)[Qt::WhatsThisRole] = "whatsThis"; | - |
| 282 | } executed: }Execution Count:45 | 45 |
| 283 | }; | - |
| 284 | } | - |
| 285 | | - |
| 286 | static DefaultRoleNames *qDefaultRoleNames() { static QGlobalStatic<DefaultRoleNames > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { DefaultRoleNames *x = new DefaultRoleNames; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<DefaultRoleNames > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:45 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:45 | yes Evaluation Count:4595 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:45 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:4640 | 0-4640 |
| 287 | | - |
| 288 | const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames() | - |
| 289 | { | - |
| 290 | return *qDefaultRoleNames(); executed: return *qDefaultRoleNames();Execution Count:4640 | 4640 |
| 291 | } | - |
| 292 | | - |
| 293 | | - |
| 294 | static uint typeOfVariant(const QVariant &value) | - |
| 295 | { | - |
| 296 | | - |
| 297 | switch (value.userType()) { | - |
| 298 | case QVariant::Bool: | - |
| 299 | case QVariant::Int: | - |
| 300 | case QVariant::UInt: | - |
| 301 | case QVariant::LongLong: | - |
| 302 | case QVariant::ULongLong: | - |
| 303 | case QVariant::Char: | - |
| 304 | case QMetaType::Short: | - |
| 305 | case QMetaType::UShort: | - |
| 306 | case QMetaType::UChar: | - |
| 307 | case QMetaType::ULong: | - |
| 308 | case QMetaType::Long: | - |
| 309 | return 0; executed: return 0;Execution Count:2 | 2 |
| 310 | case QVariant::Double: | - |
| 311 | case QMetaType::Float: | - |
| 312 | return 1; never executed: return 1; | 0 |
| 313 | default: | - |
| 314 | return 2; executed: return 2;Execution Count:19798 | 19798 |
| 315 | } | - |
| 316 | } | 0 |
| 317 | | - |
| 318 | | - |
| 319 | | - |
| 320 | | - |
| 321 | | - |
| 322 | | - |
| 323 | | - |
| 324 | bool QAbstractItemModelPrivate::variantLessThan(const QVariant &v1, const QVariant &v2) | - |
| 325 | { | - |
| 326 | switch(qMax(typeOfVariant(v1), typeOfVariant(v2))) | - |
| 327 | { | - |
| 328 | case 0: | - |
| 329 | return v1.toLongLong() < v2.toLongLong(); executed: return v1.toLongLong() < v2.toLongLong();Execution Count:1 | 1 |
| 330 | case 1: | - |
| 331 | return v1.toReal() < v2.toReal(); never executed: return v1.toReal() < v2.toReal(); | 0 |
| 332 | default: | - |
| 333 | return v1.toString().localeAwareCompare(v2.toString()) < 0; executed: return v1.toString().localeAwareCompare(v2.toString()) < 0;Execution Count:9899 | 9899 |
| 334 | } | - |
| 335 | } | 0 |
| 336 | | - |
| 337 | void QAbstractItemModelPrivate::removePersistentIndexData(QPersistentModelIndexData *data) | - |
| 338 | { | - |
| 339 | if (data->index.isValid()) { evaluated: data->index.isValid()| yes Evaluation Count:22459 | yes Evaluation Count:2 |
| 2-22459 |
| 340 | int removed = persistent.indexes.remove(data->index); | - |
| 341 | qt_noop(); | - |
| 342 | | - |
| 343 | | - |
| 344 | | - |
| 345 | (void)removed;; | - |
| 346 | } executed: }Execution Count:22459 | 22459 |
| 347 | | - |
| 348 | for (int i = persistent.moved.count() - 1; i >= 0; --i) { partially evaluated: i >= 0| no Evaluation Count:0 | yes Evaluation Count:22461 |
| 0-22461 |
| 349 | int idx = persistent.moved[i].indexOf(data); | - |
| 350 | if (idx >= 0) never evaluated: idx >= 0 | 0 |
| 351 | persistent.moved[i].remove(idx); never executed: persistent.moved[i].remove(idx); | 0 |
| 352 | } | 0 |
| 353 | | - |
| 354 | for (int i = persistent.invalidated.count() - 1; i >= 0; --i) { partially evaluated: i >= 0| no Evaluation Count:0 | yes Evaluation Count:22461 |
| 0-22461 |
| 355 | int idx = persistent.invalidated[i].indexOf(data); | - |
| 356 | if (idx >= 0) never evaluated: idx >= 0 | 0 |
| 357 | persistent.invalidated[i].remove(idx); never executed: persistent.invalidated[i].remove(idx); | 0 |
| 358 | } | 0 |
| 359 | | - |
| 360 | } executed: }Execution Count:22461 | 22461 |
| 361 | | - |
| 362 | void QAbstractItemModelPrivate::rowsAboutToBeInserted(const QModelIndex &parent, | - |
| 363 | int first, int last) | - |
| 364 | { | - |
| 365 | QAbstractItemModel * const q = q_func(); | - |
| 366 | (void)last;; | - |
| 367 | QVector<QPersistentModelIndexData *> persistent_moved; | - |
| 368 | if (first < q->rowCount(parent)) { evaluated: first < q->rowCount(parent)| yes Evaluation Count:2173 | yes Evaluation Count:108360 |
| 2173-108360 |
| 369 | for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin(); | - |
| 370 | it != persistent.indexes.constEnd(); ++it) { evaluated: it != persistent.indexes.constEnd()| yes Evaluation Count:7452 | yes Evaluation Count:2173 |
| 2173-7452 |
| 371 | QPersistentModelIndexData *data = *it; | - |
| 372 | const QModelIndex &index = data->index; | - |
| 373 | if (index.row() >= first && index.isValid() && index.parent() == parent) { evaluated: index.row() >= first| yes Evaluation Count:6112 | yes Evaluation Count:1340 |
partially evaluated: index.isValid()| yes Evaluation Count:6112 | no Evaluation Count:0 |
evaluated: index.parent() == parent| yes Evaluation Count:6083 | yes Evaluation Count:29 |
| 0-6112 |
| 374 | persistent_moved.append(data); | - |
| 375 | } executed: }Execution Count:6083 | 6083 |
| 376 | } executed: }Execution Count:7452 | 7452 |
| 377 | } executed: }Execution Count:2173 | 2173 |
| 378 | persistent.moved.push(persistent_moved); | - |
| 379 | } executed: }Execution Count:110533 | 110533 |
| 380 | | - |
| 381 | void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent, | - |
| 382 | int first, int last) | - |
| 383 | { | - |
| 384 | QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop(); | - |
| 385 | int count = (last - first) + 1; | - |
| 386 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin(); | - |
| 387 | it != persistent_moved.constEnd(); ++it) { evaluated: it != persistent_moved.constEnd()| yes Evaluation Count:6083 | yes Evaluation Count:110533 |
| 6083-110533 |
| 388 | QPersistentModelIndexData *data = *it; | - |
| 389 | QModelIndex old = data->index; | - |
| 390 | persistent.indexes.erase(persistent.indexes.find(old)); | - |
| 391 | data->index = q_func()->index(old.row() + count, old.column(), parent); | - |
| 392 | if (data->index.isValid()) { partially evaluated: data->index.isValid()| yes Evaluation Count:6083 | no Evaluation Count:0 |
| 0-6083 |
| 393 | persistent.insertMultiAtEnd(data->index, data); | - |
| 394 | } else { executed: }Execution Count:6083 | 6083 |
| 395 | QMessageLogger("itemmodels/qabstractitemmodel.cpp", 600, __PRETTY_FUNCTION__).warning() << "QAbstractItemModel::endInsertRows: Invalid index (" << old.row() + count << ',' << old.column() << ") in model" << q_func(); | - |
| 396 | } | 0 |
| 397 | } | - |
| 398 | } executed: }Execution Count:110533 | 110533 |
| 399 | | - |
| 400 | void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) | - |
| 401 | { | - |
| 402 | QVector<QPersistentModelIndexData *> persistent_moved_explicitly; | - |
| 403 | QVector<QPersistentModelIndexData *> persistent_moved_in_source; | - |
| 404 | QVector<QPersistentModelIndexData *> persistent_moved_in_destination; | - |
| 405 | | - |
| 406 | QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it; | - |
| 407 | const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator begin = persistent.indexes.constBegin(); | - |
| 408 | const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator end = persistent.indexes.constEnd(); | - |
| 409 | | - |
| 410 | const bool sameParent = (srcParent == destinationParent); | - |
| 411 | const bool movingUp = (srcFirst > destinationChild); | - |
| 412 | | - |
| 413 | for ( it = begin; it != end; ++it) { evaluated: it != end| yes Evaluation Count:2617 | yes Evaluation Count:64 |
| 64-2617 |
| 414 | QPersistentModelIndexData *data = *it; | - |
| 415 | const QModelIndex &index = data->index; | - |
| 416 | const QModelIndex &parent = index.parent(); | - |
| 417 | const bool isSourceIndex = (parent == srcParent); | - |
| 418 | const bool isDestinationIndex = (parent == destinationParent); | - |
| 419 | | - |
| 420 | int childPosition; | - |
| 421 | if (orientation == Qt::Vertical) partially evaluated: orientation == Qt::Vertical| yes Evaluation Count:2617 | no Evaluation Count:0 |
| 0-2617 |
| 422 | childPosition = index.row(); executed: childPosition = index.row();Execution Count:2617 | 2617 |
| 423 | else | - |
| 424 | childPosition = index.column(); never executed: childPosition = index.column(); | 0 |
| 425 | | - |
| 426 | if (!index.isValid() || !(isSourceIndex || isDestinationIndex ) ) partially evaluated: !index.isValid()| no Evaluation Count:0 | yes Evaluation Count:2617 |
evaluated: isSourceIndex| yes Evaluation Count:1312 | yes Evaluation Count:1305 |
evaluated: isDestinationIndex| yes Evaluation Count:823 | yes Evaluation Count:482 |
| 0-2617 |
| 427 | continue; executed: continue;Execution Count:482 | 482 |
| 428 | | - |
| 429 | if (!sameParent && isDestinationIndex) { evaluated: !sameParent| yes Evaluation Count:1655 | yes Evaluation Count:480 |
evaluated: isDestinationIndex| yes Evaluation Count:823 | yes Evaluation Count:832 |
| 480-1655 |
| 430 | if (childPosition >= destinationChild) evaluated: childPosition >= destinationChild| yes Evaluation Count:376 | yes Evaluation Count:447 |
| 376-447 |
| 431 | persistent_moved_in_destination.append(data); executed: persistent_moved_in_destination.append(data);Execution Count:376 | 376 |
| 432 | continue; executed: continue;Execution Count:823 | 823 |
| 433 | } | - |
| 434 | | - |
| 435 | if (sameParent && movingUp && childPosition < destinationChild) evaluated: sameParent| yes Evaluation Count:480 | yes Evaluation Count:832 |
evaluated: movingUp| yes Evaluation Count:160 | yes Evaluation Count:320 |
evaluated: childPosition < destinationChild| yes Evaluation Count:28 | yes Evaluation Count:132 |
| 28-832 |
| 436 | continue; executed: continue;Execution Count:28 | 28 |
| 437 | | - |
| 438 | if (sameParent && !movingUp && childPosition < srcFirst ) evaluated: sameParent| yes Evaluation Count:452 | yes Evaluation Count:832 |
evaluated: !movingUp| yes Evaluation Count:320 | yes Evaluation Count:132 |
evaluated: childPosition < srcFirst| yes Evaluation Count:48 | yes Evaluation Count:272 |
| 48-832 |
| 439 | continue; executed: continue;Execution Count:48 | 48 |
| 440 | | - |
| 441 | if (!sameParent && childPosition < srcFirst) evaluated: !sameParent| yes Evaluation Count:832 | yes Evaluation Count:404 |
evaluated: childPosition < srcFirst| yes Evaluation Count:386 | yes Evaluation Count:446 |
| 386-832 |
| 442 | continue; executed: continue;Execution Count:386 | 386 |
| 443 | | - |
| 444 | if (sameParent && (childPosition > srcLast) && (childPosition >= destinationChild )) evaluated: sameParent| yes Evaluation Count:404 | yes Evaluation Count:446 |
evaluated: (childPosition > srcLast)| yes Evaluation Count:192 | yes Evaluation Count:212 |
evaluated: (childPosition >= destinationChild )| yes Evaluation Count:48 | yes Evaluation Count:144 |
| 48-446 |
| 445 | continue; executed: continue;Execution Count:48 | 48 |
| 446 | | - |
| 447 | if ((childPosition <= srcLast) && (childPosition >= srcFirst)) { evaluated: (childPosition <= srcLast)| yes Evaluation Count:463 | yes Evaluation Count:339 |
evaluated: (childPosition >= srcFirst)| yes Evaluation Count:387 | yes Evaluation Count:76 |
| 76-463 |
| 448 | persistent_moved_explicitly.append(data); | - |
| 449 | } else { executed: }Execution Count:387 | 387 |
| 450 | persistent_moved_in_source.append(data); | - |
| 451 | } executed: }Execution Count:415 | 415 |
| 452 | } | - |
| 453 | persistent.moved.push(persistent_moved_explicitly); | - |
| 454 | persistent.moved.push(persistent_moved_in_source); | - |
| 455 | persistent.moved.push(persistent_moved_in_destination); | - |
| 456 | } executed: }Execution Count:64 | 64 |
| 457 | void QAbstractItemModelPrivate::movePersistentIndexes(QVector<QPersistentModelIndexData *> indexes, int change, const QModelIndex &parent, Qt::Orientation orientation) | - |
| 458 | { | - |
| 459 | QVector<QPersistentModelIndexData *>::const_iterator it; | - |
| 460 | const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin(); | - |
| 461 | const QVector<QPersistentModelIndexData *>::const_iterator end = indexes.constEnd(); | - |
| 462 | | - |
| 463 | for (it = begin; it != end; ++it) evaluated: it != end| yes Evaluation Count:1178 | yes Evaluation Count:192 |
| 192-1178 |
| 464 | { | - |
| 465 | QPersistentModelIndexData *data = *it; | - |
| 466 | | - |
| 467 | int row = data->index.row(); | - |
| 468 | int column = data->index.column(); | - |
| 469 | | - |
| 470 | if (Qt::Vertical == orientation) partially evaluated: Qt::Vertical == orientation| yes Evaluation Count:1178 | no Evaluation Count:0 |
| 0-1178 |
| 471 | row += change; executed: row += change;Execution Count:1178 | 1178 |
| 472 | else | - |
| 473 | column += change; never executed: column += change; | 0 |
| 474 | | - |
| 475 | persistent.indexes.erase(persistent.indexes.find(data->index)); | - |
| 476 | data->index = q_func()->index(row, column, parent); | - |
| 477 | if (data->index.isValid()) { partially evaluated: data->index.isValid()| yes Evaluation Count:1178 | no Evaluation Count:0 |
| 0-1178 |
| 478 | persistent.insertMultiAtEnd(data->index, data); | - |
| 479 | } else { executed: }Execution Count:1178 | 1178 |
| 480 | QMessageLogger("itemmodels/qabstractitemmodel.cpp", 693, __PRETTY_FUNCTION__).warning() << "QAbstractItemModel::endMoveRows: Invalid index (" << row << "," << column << ") in model" << q_func(); | - |
| 481 | } | 0 |
| 482 | } | - |
| 483 | } executed: }Execution Count:192 | 192 |
| 484 | | - |
| 485 | void QAbstractItemModelPrivate::itemsMoved(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation) | - |
| 486 | { | - |
| 487 | QVector<QPersistentModelIndexData *> moved_in_destination = persistent.moved.pop(); | - |
| 488 | QVector<QPersistentModelIndexData *> moved_in_source = persistent.moved.pop(); | - |
| 489 | QVector<QPersistentModelIndexData *> moved_explicitly = persistent.moved.pop(); | - |
| 490 | | - |
| 491 | const bool sameParent = (sourceParent == destinationParent); | - |
| 492 | const bool movingUp = (sourceFirst > destinationChild); | - |
| 493 | | - |
| 494 | const int explicit_change = (!sameParent || movingUp) ? destinationChild - sourceFirst : destinationChild - sourceLast - 1 ; evaluated: !sameParent| yes Evaluation Count:46 | yes Evaluation Count:18 |
evaluated: movingUp| yes Evaluation Count:10 | yes Evaluation Count:8 |
| 8-46 |
| 495 | const int source_change = (!sameParent || !movingUp) ? -1*(sourceLast - sourceFirst + 1) : sourceLast - sourceFirst + 1 ; evaluated: !sameParent| yes Evaluation Count:46 | yes Evaluation Count:18 |
evaluated: !movingUp| yes Evaluation Count:8 | yes Evaluation Count:10 |
| 8-46 |
| 496 | const int destination_change = sourceLast - sourceFirst + 1; | - |
| 497 | | - |
| 498 | movePersistentIndexes(moved_explicitly, explicit_change, destinationParent, orientation); | - |
| 499 | movePersistentIndexes(moved_in_source, source_change, sourceParent, orientation); | - |
| 500 | movePersistentIndexes(moved_in_destination, destination_change, destinationParent, orientation); | - |
| 501 | } executed: }Execution Count:64 | 64 |
| 502 | | - |
| 503 | void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent, | - |
| 504 | int first, int last) | - |
| 505 | { | - |
| 506 | QVector<QPersistentModelIndexData *> persistent_moved; | - |
| 507 | QVector<QPersistentModelIndexData *> persistent_invalidated; | - |
| 508 | | - |
| 509 | | - |
| 510 | for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin(); | - |
| 511 | it != persistent.indexes.constEnd(); ++it) { evaluated: it != persistent.indexes.constEnd()| yes Evaluation Count:2547 | yes Evaluation Count:2024 |
| 2024-2547 |
| 512 | QPersistentModelIndexData *data = *it; | - |
| 513 | bool level_changed = false; | - |
| 514 | QModelIndex current = data->index; | - |
| 515 | while (current.isValid()) { evaluated: current.isValid()| yes Evaluation Count:2824 | yes Evaluation Count:130 |
| 130-2824 |
| 516 | QModelIndex current_parent = current.parent(); | - |
| 517 | if (current_parent == parent) { evaluated: current_parent == parent| yes Evaluation Count:2417 | yes Evaluation Count:407 |
| 407-2417 |
| 518 | if (!level_changed && current.row() > last) evaluated: !level_changed| yes Evaluation Count:2367 | yes Evaluation Count:50 |
evaluated: current.row() > last| yes Evaluation Count:1075 | yes Evaluation Count:1292 |
| 50-2367 |
| 519 | persistent_moved.append(data); executed: persistent_moved.append(data);Execution Count:1075 | 1075 |
| 520 | else if (current.row() <= last && current.row() >= first) partially evaluated: current.row() <= last| yes Evaluation Count:1342 | no Evaluation Count:0 |
evaluated: current.row() >= first| yes Evaluation Count:279 | yes Evaluation Count:1063 |
| 0-1342 |
| 521 | persistent_invalidated.append(data); executed: persistent_invalidated.append(data);Execution Count:279 | 279 |
| 522 | break; executed: break;Execution Count:2417 | 2417 |
| 523 | } | - |
| 524 | current = current_parent; | - |
| 525 | level_changed = true; | - |
| 526 | } executed: }Execution Count:407 | 407 |
| 527 | } executed: }Execution Count:2547 | 2547 |
| 528 | | - |
| 529 | persistent.moved.push(persistent_moved); | - |
| 530 | persistent.invalidated.push(persistent_invalidated); | - |
| 531 | } executed: }Execution Count:2024 | 2024 |
| 532 | | - |
| 533 | void QAbstractItemModelPrivate::rowsRemoved(const QModelIndex &parent, | - |
| 534 | int first, int last) | - |
| 535 | { | - |
| 536 | QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop(); | - |
| 537 | int count = (last - first) + 1; | - |
| 538 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin(); | - |
| 539 | it != persistent_moved.constEnd(); ++it) { evaluated: it != persistent_moved.constEnd()| yes Evaluation Count:1075 | yes Evaluation Count:2024 |
| 1075-2024 |
| 540 | QPersistentModelIndexData *data = *it; | - |
| 541 | QModelIndex old = data->index; | - |
| 542 | persistent.indexes.erase(persistent.indexes.find(old)); | - |
| 543 | data->index = q_func()->index(old.row() - count, old.column(), parent); | - |
| 544 | if (data->index.isValid()) { partially evaluated: data->index.isValid()| yes Evaluation Count:1075 | no Evaluation Count:0 |
| 0-1075 |
| 545 | persistent.insertMultiAtEnd(data->index, data); | - |
| 546 | } else { executed: }Execution Count:1075 | 1075 |
| 547 | QMessageLogger("itemmodels/qabstractitemmodel.cpp", 760, __PRETTY_FUNCTION__).warning() << "QAbstractItemModel::endRemoveRows: Invalid index (" << old.row() - count << ',' << old.column() << ") in model" << q_func(); | - |
| 548 | } | 0 |
| 549 | } | - |
| 550 | QVector<QPersistentModelIndexData *> persistent_invalidated = persistent.invalidated.pop(); | - |
| 551 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_invalidated.constBegin(); | - |
| 552 | it != persistent_invalidated.constEnd(); ++it) { evaluated: it != persistent_invalidated.constEnd()| yes Evaluation Count:279 | yes Evaluation Count:2024 |
| 279-2024 |
| 553 | QPersistentModelIndexData *data = *it; | - |
| 554 | persistent.indexes.erase(persistent.indexes.find(data->index)); | - |
| 555 | data->index = QModelIndex(); | - |
| 556 | data->model = 0; | - |
| 557 | } executed: }Execution Count:279 | 279 |
| 558 | } executed: }Execution Count:2024 | 2024 |
| 559 | | - |
| 560 | void QAbstractItemModelPrivate::columnsAboutToBeInserted(const QModelIndex &parent, | - |
| 561 | int first, int last) | - |
| 562 | { | - |
| 563 | QAbstractItemModel * const q = q_func(); | - |
| 564 | (void)last;; | - |
| 565 | QVector<QPersistentModelIndexData *> persistent_moved; | - |
| 566 | if (first < q->columnCount(parent)) { evaluated: first < q->columnCount(parent)| yes Evaluation Count:335 | yes Evaluation Count:10476 |
| 335-10476 |
| 567 | for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin(); | - |
| 568 | it != persistent.indexes.constEnd(); ++it) { evaluated: it != persistent.indexes.constEnd()| yes Evaluation Count:51 | yes Evaluation Count:335 |
| 51-335 |
| 569 | QPersistentModelIndexData *data = *it; | - |
| 570 | const QModelIndex &index = data->index; | - |
| 571 | if (index.column() >= first && index.isValid() && index.parent() == parent) evaluated: index.column() >= first| yes Evaluation Count:26 | yes Evaluation Count:25 |
partially evaluated: index.isValid()| yes Evaluation Count:26 | no Evaluation Count:0 |
evaluated: index.parent() == parent| yes Evaluation Count:11 | yes Evaluation Count:15 |
| 0-26 |
| 572 | persistent_moved.append(data); executed: persistent_moved.append(data);Execution Count:11 | 11 |
| 573 | } executed: }Execution Count:51 | 51 |
| 574 | } executed: }Execution Count:335 | 335 |
| 575 | persistent.moved.push(persistent_moved); | - |
| 576 | } executed: }Execution Count:10811 | 10811 |
| 577 | | - |
| 578 | void QAbstractItemModelPrivate::columnsInserted(const QModelIndex &parent, | - |
| 579 | int first, int last) | - |
| 580 | { | - |
| 581 | QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop(); | - |
| 582 | int count = (last - first) + 1; | - |
| 583 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin(); | - |
| 584 | it != persistent_moved.constEnd(); ++it) { evaluated: it != persistent_moved.constEnd()| yes Evaluation Count:11 | yes Evaluation Count:10811 |
| 11-10811 |
| 585 | QPersistentModelIndexData *data = *it; | - |
| 586 | QModelIndex old = data->index; | - |
| 587 | persistent.indexes.erase(persistent.indexes.find(old)); | - |
| 588 | data->index = q_func()->index(old.row(), old.column() + count, parent); | - |
| 589 | if (data->index.isValid()) { partially evaluated: data->index.isValid()| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 590 | persistent.insertMultiAtEnd(data->index, data); | - |
| 591 | } else { executed: }Execution Count:11 | 11 |
| 592 | QMessageLogger("itemmodels/qabstractitemmodel.cpp", 805, __PRETTY_FUNCTION__).warning() << "QAbstractItemModel::endInsertColumns: Invalid index (" << old.row() << ',' << old.column() + count << ") in model" << q_func(); | - |
| 593 | } | 0 |
| 594 | } | - |
| 595 | } executed: }Execution Count:10811 | 10811 |
| 596 | | - |
| 597 | void QAbstractItemModelPrivate::columnsAboutToBeRemoved(const QModelIndex &parent, | - |
| 598 | int first, int last) | - |
| 599 | { | - |
| 600 | QVector<QPersistentModelIndexData *> persistent_moved; | - |
| 601 | QVector<QPersistentModelIndexData *> persistent_invalidated; | - |
| 602 | | - |
| 603 | | - |
| 604 | for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin(); | - |
| 605 | it != persistent.indexes.constEnd(); ++it) { evaluated: it != persistent.indexes.constEnd()| yes Evaluation Count:96 | yes Evaluation Count:204 |
| 96-204 |
| 606 | QPersistentModelIndexData *data = *it; | - |
| 607 | bool level_changed = false; | - |
| 608 | QModelIndex current = data->index; | - |
| 609 | while (current.isValid()) { evaluated: current.isValid()| yes Evaluation Count:97 | yes Evaluation Count:35 |
| 35-97 |
| 610 | QModelIndex current_parent = current.parent(); | - |
| 611 | if (current_parent == parent) { evaluated: current_parent == parent| yes Evaluation Count:61 | yes Evaluation Count:36 |
| 36-61 |
| 612 | if (!level_changed && current.column() > last) evaluated: !level_changed| yes Evaluation Count:60 | yes Evaluation Count:1 |
evaluated: current.column() > last| yes Evaluation Count:15 | yes Evaluation Count:45 |
| 1-60 |
| 613 | persistent_moved.append(data); executed: persistent_moved.append(data);Execution Count:15 | 15 |
| 614 | else if (current.column() <= last && current.column() >= first) partially evaluated: current.column() <= last| yes Evaluation Count:46 | no Evaluation Count:0 |
evaluated: current.column() >= first| yes Evaluation Count:24 | yes Evaluation Count:22 |
| 0-46 |
| 615 | persistent_invalidated.append(data); executed: persistent_invalidated.append(data);Execution Count:24 | 24 |
| 616 | break; executed: break;Execution Count:61 | 61 |
| 617 | } | - |
| 618 | current = current_parent; | - |
| 619 | level_changed = true; | - |
| 620 | } executed: }Execution Count:36 | 36 |
| 621 | } executed: }Execution Count:96 | 96 |
| 622 | | - |
| 623 | persistent.moved.push(persistent_moved); | - |
| 624 | persistent.invalidated.push(persistent_invalidated); | - |
| 625 | | - |
| 626 | } executed: }Execution Count:204 | 204 |
| 627 | | - |
| 628 | void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent, | - |
| 629 | int first, int last) | - |
| 630 | { | - |
| 631 | QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop(); | - |
| 632 | int count = (last - first) + 1; | - |
| 633 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin(); | - |
| 634 | it != persistent_moved.constEnd(); ++it) { evaluated: it != persistent_moved.constEnd()| yes Evaluation Count:15 | yes Evaluation Count:204 |
| 15-204 |
| 635 | QPersistentModelIndexData *data = *it; | - |
| 636 | QModelIndex old = data->index; | - |
| 637 | persistent.indexes.erase(persistent.indexes.find(old)); | - |
| 638 | data->index = q_func()->index(old.row(), old.column() - count, parent); | - |
| 639 | if (data->index.isValid()) { partially evaluated: data->index.isValid()| yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
| 640 | persistent.insertMultiAtEnd(data->index, data); | - |
| 641 | } else { executed: }Execution Count:15 | 15 |
| 642 | QMessageLogger("itemmodels/qabstractitemmodel.cpp", 855, __PRETTY_FUNCTION__).warning() << "QAbstractItemModel::endRemoveColumns: Invalid index (" << old.row() << ',' << old.column() - count << ") in model" << q_func(); | - |
| 643 | } | 0 |
| 644 | } | - |
| 645 | QVector<QPersistentModelIndexData *> persistent_invalidated = persistent.invalidated.pop(); | - |
| 646 | for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_invalidated.constBegin(); | - |
| 647 | it != persistent_invalidated.constEnd(); ++it) { evaluated: it != persistent_invalidated.constEnd()| yes Evaluation Count:24 | yes Evaluation Count:204 |
| 24-204 |
| 648 | QPersistentModelIndexData *data = *it; | - |
| 649 | persistent.indexes.erase(persistent.indexes.find(data->index)); | - |
| 650 | data->index = QModelIndex(); | - |
| 651 | data->model = 0; | - |
| 652 | } executed: }Execution Count:24 | 24 |
| 653 | } executed: }Execution Count:204 | 204 |
| 654 | QAbstractItemModel::QAbstractItemModel(QObject *parent) | - |
| 655 | : QObject(*new QAbstractItemModelPrivate, parent) | - |
| 656 | { | - |
| 657 | } executed: }Execution Count:1434 | 1434 |
| 658 | | - |
| 659 | | - |
| 660 | | - |
| 661 | | - |
| 662 | QAbstractItemModel::QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent) | - |
| 663 | : QObject(dd, parent) | - |
| 664 | { | - |
| 665 | } executed: }Execution Count:3206 | 3206 |
| 666 | | - |
| 667 | | - |
| 668 | | - |
| 669 | | - |
| 670 | QAbstractItemModel::~QAbstractItemModel() | - |
| 671 | { | - |
| 672 | d_func()->invalidatePersistentIndexes(); | - |
| 673 | } executed: }Execution Count:4475 | 4475 |
| 674 | bool QAbstractItemModel::hasIndex(int row, int column, const QModelIndex &parent) const | - |
| 675 | { | - |
| 676 | if (row < 0 || column < 0) evaluated: row < 0| yes Evaluation Count:896 | yes Evaluation Count:174055 |
evaluated: column < 0| yes Evaluation Count:1331 | yes Evaluation Count:172724 |
| 896-174055 |
| 677 | return false; executed: return false;Execution Count:2227 | 2227 |
| 678 | return row < rowCount(parent) && column < columnCount(parent); executed: return row < rowCount(parent) && column < columnCount(parent);Execution Count:172724 | 172724 |
| 679 | } | - |
| 680 | bool QAbstractItemModel::hasChildren(const QModelIndex &parent) const | - |
| 681 | { | - |
| 682 | return (rowCount(parent) > 0) && (columnCount(parent) > 0); executed: return (rowCount(parent) > 0) && (columnCount(parent) > 0);Execution Count:2129 | 2129 |
| 683 | } | - |
| 684 | QModelIndex QAbstractItemModel::sibling(int row, int column, const QModelIndex &idx) const | - |
| 685 | { | - |
| 686 | return (row == idx.row() && column == idx.column()) ? idx : index(row, column, parent(idx)); executed: return (row == idx.row() && column == idx.column()) ? idx : index(row, column, parent(idx));Execution Count:14101 | 14101 |
| 687 | } | - |
| 688 | QMap<int, QVariant> QAbstractItemModel::itemData(const QModelIndex &index) const | - |
| 689 | { | - |
| 690 | QMap<int, QVariant> roles; | - |
| 691 | for (int i = 0; i < Qt::UserRole; ++i) { evaluated: i < Qt::UserRole| yes Evaluation Count:110336 | yes Evaluation Count:431 |
| 431-110336 |
| 692 | QVariant variantData = data(index, i); | - |
| 693 | if (variantData.isValid()) evaluated: variantData.isValid()| yes Evaluation Count:101120 | yes Evaluation Count:9216 |
| 9216-101120 |
| 694 | roles.insert(i, variantData); executed: roles.insert(i, variantData);Execution Count:101120 | 101120 |
| 695 | } executed: }Execution Count:110336 | 110336 |
| 696 | return roles; executed: return roles;Execution Count:431 | 431 |
| 697 | } | - |
| 698 | bool QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role) | - |
| 699 | { | - |
| 700 | (void)index;; | - |
| 701 | (void)value;; | - |
| 702 | (void)role;; | - |
| 703 | return false; executed: return false;Execution Count:25 | 25 |
| 704 | } | - |
| 705 | bool QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) | - |
| 706 | { | - |
| 707 | bool b = true; | - |
| 708 | for (QMap<int, QVariant>::ConstIterator it = roles.begin(); it != roles.end(); ++it) evaluated: it != roles.end()| yes Evaluation Count:11776 | yes Evaluation Count:56 |
| 56-11776 |
| 709 | b = b && setData(index, it.value(), it.key()); executed: b = b && setData(index, it.value(), it.key());Execution Count:11776 partially evaluated: b| yes Evaluation Count:11776 | no Evaluation Count:0 |
partially evaluated: setData(index, it.value(), it.key())| yes Evaluation Count:11776 | no Evaluation Count:0 |
| 0-11776 |
| 710 | return b; executed: return b;Execution Count:56 | 56 |
| 711 | } | - |
| 712 | | - |
| 713 | | - |
| 714 | | - |
| 715 | | - |
| 716 | | - |
| 717 | | - |
| 718 | | - |
| 719 | QStringList QAbstractItemModel::mimeTypes() const | - |
| 720 | { | - |
| 721 | QStringList types; | - |
| 722 | types << QLatin1String("application/x-qabstractitemmodeldatalist"); | - |
| 723 | return types; executed: return types;Execution Count:145 | 145 |
| 724 | } | - |
| 725 | QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const | - |
| 726 | { | - |
| 727 | if (indexes.count() <= 0) partially evaluated: indexes.count() <= 0| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 728 | return 0; never executed: return 0; | 0 |
| 729 | QStringList types = mimeTypes(); | - |
| 730 | if (types.isEmpty()) partially evaluated: types.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 731 | return 0; never executed: return 0; | 0 |
| 732 | QMimeData *data = new QMimeData(); | - |
| 733 | QString format = types.at(0); | - |
| 734 | QByteArray encoded; | - |
| 735 | QDataStream stream(&encoded, QIODevice::WriteOnly); | - |
| 736 | encodeData(indexes, stream); | - |
| 737 | data->setData(format, encoded); | - |
| 738 | return data; executed: return data;Execution Count:12 | 12 |
| 739 | } | - |
| 740 | bool QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction action, | - |
| 741 | int row, int column, | - |
| 742 | const QModelIndex &parent) const | - |
| 743 | { | - |
| 744 | (void)data; | - |
| 745 | (void)action; | - |
| 746 | (void)row; | - |
| 747 | (void)column; | - |
| 748 | (void)parent; | - |
| 749 | return true; never executed: return true; | 0 |
| 750 | } | - |
| 751 | bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - |
| 752 | int row, int column, const QModelIndex &parent) | - |
| 753 | { | - |
| 754 | | - |
| 755 | if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction)) partially evaluated: !data| no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: action == Qt::CopyAction| yes Evaluation Count:12 | no Evaluation Count:0 |
never evaluated: action == Qt::MoveAction | 0-12 |
| 756 | return false; never executed: return false; | 0 |
| 757 | | - |
| 758 | QStringList types = mimeTypes(); | - |
| 759 | if (types.isEmpty()) partially evaluated: types.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 760 | return false; never executed: return false; | 0 |
| 761 | QString format = types.at(0); | - |
| 762 | if (!data->hasFormat(format)) partially evaluated: !data->hasFormat(format)| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 763 | return false; never executed: return false; | 0 |
| 764 | if (row > rowCount(parent)) evaluated: row > rowCount(parent)| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 765 | row = rowCount(parent); executed: row = rowCount(parent);Execution Count:4 | 4 |
| 766 | if (row == -1) partially evaluated: row == -1| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 767 | row = rowCount(parent); never executed: row = rowCount(parent); | 0 |
| 768 | if (column == -1) partially evaluated: column == -1| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 769 | column = 0; never executed: column = 0; | 0 |
| 770 | | - |
| 771 | QByteArray encoded = data->data(format); | - |
| 772 | QDataStream stream(&encoded, QIODevice::ReadOnly); | - |
| 773 | return decodeData(row, column, parent, stream); executed: return decodeData(row, column, parent, stream);Execution Count:12 | 12 |
| 774 | } | - |
| 775 | Qt::DropActions QAbstractItemModel::supportedDropActions() const | - |
| 776 | { | - |
| 777 | return Qt::CopyAction; executed: return Qt::CopyAction;Execution Count:91 | 91 |
| 778 | } | - |
| 779 | Qt::DropActions QAbstractItemModel::supportedDragActions() const | - |
| 780 | { | - |
| 781 | const QAbstractItemModelPrivate * const d = d_func(); | - |
| 782 | if (d->supportedDragActions != -1) partially evaluated: d->supportedDragActions != -1| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 783 | return d->supportedDragActions; never executed: return d->supportedDragActions; | 0 |
| 784 | return supportedDropActions(); executed: return supportedDropActions();Execution Count:1 | 1 |
| 785 | } | - |
| 786 | | - |
| 787 | | - |
| 788 | | - |
| 789 | | - |
| 790 | void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions) | - |
| 791 | { | - |
| 792 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 793 | d->supportedDragActions = actions; | - |
| 794 | } | 0 |
| 795 | bool QAbstractItemModel::insertRows(int, int, const QModelIndex &) | - |
| 796 | { | - |
| 797 | return false; never executed: return false; | 0 |
| 798 | } | - |
| 799 | bool QAbstractItemModel::insertColumns(int, int, const QModelIndex &) | - |
| 800 | { | - |
| 801 | return false; executed: return false;Execution Count:76 | 76 |
| 802 | } | - |
| 803 | bool QAbstractItemModel::removeRows(int, int, const QModelIndex &) | - |
| 804 | { | - |
| 805 | return false; never executed: return false; | 0 |
| 806 | } | - |
| 807 | bool QAbstractItemModel::removeColumns(int, int, const QModelIndex &) | - |
| 808 | { | - |
| 809 | return false; executed: return false;Execution Count:132 | 132 |
| 810 | } | - |
| 811 | bool QAbstractItemModel::moveRows(const QModelIndex &, int , int , const QModelIndex &, int) | - |
| 812 | { | - |
| 813 | return false; never executed: return false; | 0 |
| 814 | } | - |
| 815 | bool QAbstractItemModel::moveColumns(const QModelIndex &, int , int , const QModelIndex &, int) | - |
| 816 | { | - |
| 817 | return false; never executed: return false; | 0 |
| 818 | } | - |
| 819 | void QAbstractItemModel::fetchMore(const QModelIndex &) | - |
| 820 | { | - |
| 821 | | - |
| 822 | } | - |
| 823 | bool QAbstractItemModel::canFetchMore(const QModelIndex &) const | - |
| 824 | { | - |
| 825 | return false; executed: return false;Execution Count:5989 | 5989 |
| 826 | } | - |
| 827 | Qt::ItemFlags QAbstractItemModel::flags(const QModelIndex &index) const | - |
| 828 | { | - |
| 829 | const QAbstractItemModelPrivate * const d = d_func(); | - |
| 830 | if (!d->indexValid(index)) evaluated: !d->indexValid(index)| yes Evaluation Count:36 | yes Evaluation Count:27800 |
| 36-27800 |
| 831 | return 0; executed: return 0;Execution Count:36 | 36 |
| 832 | | - |
| 833 | return Qt::ItemIsSelectable|Qt::ItemIsEnabled; executed: return Qt::ItemIsSelectable|Qt::ItemIsEnabled;Execution Count:27800 | 27800 |
| 834 | } | - |
| 835 | | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | | - |
| 840 | | - |
| 841 | void QAbstractItemModel::sort(int column, Qt::SortOrder order) | - |
| 842 | { | - |
| 843 | (void)column;; | - |
| 844 | (void)order;; | - |
| 845 | | - |
| 846 | } executed: }Execution Count:398 | 398 |
| 847 | QModelIndex QAbstractItemModel::buddy(const QModelIndex &index) const | - |
| 848 | { | - |
| 849 | return index; executed: return index;Execution Count:18902 | 18902 |
| 850 | } | - |
| 851 | QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role, | - |
| 852 | const QVariant &value, int hits, | - |
| 853 | Qt::MatchFlags flags) const | - |
| 854 | { | - |
| 855 | QModelIndexList result; | - |
| 856 | uint matchType = flags & 0x0F; | - |
| 857 | Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive; evaluated: flags & Qt::MatchCaseSensitive| yes Evaluation Count:23 | yes Evaluation Count:199 |
| 23-199 |
| 858 | bool recurse = flags & Qt::MatchRecursive; | - |
| 859 | bool wrap = flags & Qt::MatchWrap; | - |
| 860 | bool allHits = (hits == -1); | - |
| 861 | QString text; | - |
| 862 | QModelIndex p = parent(start); | - |
| 863 | int from = start.row(); | - |
| 864 | int to = rowCount(p); | - |
| 865 | | - |
| 866 | | - |
| 867 | for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) { evaluated: wrap| yes Evaluation Count:474 | yes Evaluation Count:128 |
evaluated: i < 2| yes Evaluation Count:316 | yes Evaluation Count:158 |
evaluated: !wrap| yes Evaluation Count:128 | yes Evaluation Count:158 |
evaluated: i < 1| yes Evaluation Count:64 | yes Evaluation Count:64 |
| 64-474 |
| 868 | for (int r = from; (r < to) && (allHits || result.count() < hits); ++r) { evaluated: (r < to)| yes Evaluation Count:2323 | yes Evaluation Count:349 |
evaluated: allHits| yes Evaluation Count:88 | yes Evaluation Count:2235 |
evaluated: result.count() < hits| yes Evaluation Count:2204 | yes Evaluation Count:31 |
| 31-2323 |
| 869 | QModelIndex idx = index(r, start.column(), p); | - |
| 870 | if (!idx.isValid()) evaluated: !idx.isValid()| yes Evaluation Count:1854 | yes Evaluation Count:438 |
| 438-1854 |
| 871 | continue; executed: continue;Execution Count:1854 | 1854 |
| 872 | QVariant v = data(idx, role); | - |
| 873 | | - |
| 874 | if (matchType == Qt::MatchExactly) { evaluated: matchType == Qt::MatchExactly| yes Evaluation Count:95 | yes Evaluation Count:343 |
| 95-343 |
| 875 | if (value == v) evaluated: value == v| yes Evaluation Count:25 | yes Evaluation Count:70 |
| 25-70 |
| 876 | result.append(idx); executed: result.append(idx);Execution Count:25 | 25 |
| 877 | } else { executed: }Execution Count:95 | 95 |
| 878 | if (text.isEmpty()) evaluated: text.isEmpty()| yes Evaluation Count:126 | yes Evaluation Count:217 |
| 126-217 |
| 879 | text = value.toString(); executed: text = value.toString();Execution Count:126 | 126 |
| 880 | QString t = v.toString(); | - |
| 881 | switch (matchType) { | - |
| 882 | case Qt::MatchRegExp: | - |
| 883 | if (QRegExp(text, cs).exactMatch(t)) evaluated: QRegExp(text, cs).exactMatch(t)| yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
| 884 | result.append(idx); executed: result.append(idx);Execution Count:2 | 2 |
| 885 | break; executed: break;Execution Count:8 | 8 |
| 886 | case Qt::MatchWildcard: | - |
| 887 | if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t)) evaluated: QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 888 | result.append(idx); executed: result.append(idx);Execution Count:3 | 3 |
| 889 | break; executed: break;Execution Count:4 | 4 |
| 890 | case Qt::MatchStartsWith: | - |
| 891 | if (t.startsWith(text, cs)) evaluated: t.startsWith(text, cs)| yes Evaluation Count:20 | yes Evaluation Count:278 |
| 20-278 |
| 892 | result.append(idx); executed: result.append(idx);Execution Count:20 | 20 |
| 893 | break; executed: break;Execution Count:298 | 298 |
| 894 | case Qt::MatchEndsWith: | - |
| 895 | if (t.endsWith(text, cs)) evaluated: t.endsWith(text, cs)| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 896 | result.append(idx); executed: result.append(idx);Execution Count:2 | 2 |
| 897 | break; executed: break;Execution Count:4 | 4 |
| 898 | case Qt::MatchFixedString: | - |
| 899 | if (t.compare(text, cs) == 0) evaluated: t.compare(text, cs) == 0| yes Evaluation Count:8 | yes Evaluation Count:17 |
| 8-17 |
| 900 | result.append(idx); executed: result.append(idx);Execution Count:8 | 8 |
| 901 | break; executed: break;Execution Count:25 | 25 |
| 902 | case Qt::MatchContains: | - |
| 903 | default: | - |
| 904 | if (t.contains(text, cs)) evaluated: t.contains(text, cs)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 905 | result.append(idx); executed: result.append(idx);Execution Count:3 | 3 |
| 906 | } executed: }Execution Count:4 | 4 |
| 907 | } executed: }Execution Count:343 | 343 |
| 908 | if (recurse && hasChildren(idx)) { evaluated: recurse| yes Evaluation Count:40 | yes Evaluation Count:398 |
evaluated: hasChildren(idx)| yes Evaluation Count:13 | yes Evaluation Count:27 |
| 13-398 |
| 909 | result += match(index(0, idx.column(), idx), role, | - |
| 910 | (text.isEmpty() ? value : text), | - |
| 911 | (allHits ? -1 : hits - result.count()), flags); | - |
| 912 | } executed: }Execution Count:13 | 13 |
| 913 | } executed: }Execution Count:438 | 438 |
| 914 | | - |
| 915 | from = 0; | - |
| 916 | to = start.row(); | - |
| 917 | } executed: }Execution Count:380 | 380 |
| 918 | return result; executed: return result;Execution Count:222 | 222 |
| 919 | } | - |
| 920 | | - |
| 921 | | - |
| 922 | | - |
| 923 | | - |
| 924 | | - |
| 925 | | - |
| 926 | | - |
| 927 | QSize QAbstractItemModel::span(const QModelIndex &) const | - |
| 928 | { | - |
| 929 | return QSize(1, 1); executed: return QSize(1, 1);Execution Count:122 | 122 |
| 930 | } | - |
| 931 | void QAbstractItemModel::doSetRoleNames(const QHash<int,QByteArray> &roleNames) | - |
| 932 | { | - |
| 933 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 934 | d->roleNames = roleNames; | - |
| 935 | } executed: }Execution Count:2 | 2 |
| 936 | | - |
| 937 | | - |
| 938 | | - |
| 939 | | - |
| 940 | | - |
| 941 | | - |
| 942 | | - |
| 943 | QHash<int,QByteArray> QAbstractItemModel::roleNames() const | - |
| 944 | { | - |
| 945 | const QAbstractItemModelPrivate * const d = d_func(); | - |
| 946 | return d->roleNames; executed: return d->roleNames;Execution Count:1709 | 1709 |
| 947 | } | - |
| 948 | bool QAbstractItemModel::submit() | - |
| 949 | { | - |
| 950 | return true; executed: return true;Execution Count:2840 | 2840 |
| 951 | } | - |
| 952 | void QAbstractItemModel::revert() | - |
| 953 | { | - |
| 954 | | - |
| 955 | } | - |
| 956 | QVariant QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const | - |
| 957 | { | - |
| 958 | (void)orientation;; | - |
| 959 | if (role == Qt::DisplayRole) evaluated: role == Qt::DisplayRole| yes Evaluation Count:20912 | yes Evaluation Count:69134 |
| 20912-69134 |
| 960 | return section + 1; executed: return section + 1;Execution Count:20912 | 20912 |
| 961 | return QVariant(); executed: return QVariant();Execution Count:69134 | 69134 |
| 962 | } | - |
| 963 | bool QAbstractItemModel::setHeaderData(int section, Qt::Orientation orientation, | - |
| 964 | const QVariant &value, int role) | - |
| 965 | { | - |
| 966 | (void)section;; | - |
| 967 | (void)orientation;; | - |
| 968 | (void)value;; | - |
| 969 | (void)role;; | - |
| 970 | return false; executed: return false;Execution Count:84 | 84 |
| 971 | } | - |
| 972 | void QAbstractItemModel::encodeData(const QModelIndexList &indexes, QDataStream &stream) const | - |
| 973 | { | - |
| 974 | QModelIndexList::ConstIterator it = indexes.begin(); | - |
| 975 | for (; it != indexes.end(); ++it) evaluated: it != indexes.end()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 976 | stream << (*it).row() << (*it).column() << itemData(*it); executed: stream << (*it).row() << (*it).column() << itemData(*it);Execution Count:46 | 46 |
| 977 | } executed: }Execution Count:12 | 12 |
| 978 | | - |
| 979 | | - |
| 980 | | - |
| 981 | | - |
| 982 | bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &parent, | - |
| 983 | QDataStream &stream) | - |
| 984 | { | - |
| 985 | int top = 2147483647; | - |
| 986 | int left = 2147483647; | - |
| 987 | int bottom = 0; | - |
| 988 | int right = 0; | - |
| 989 | QVector<int> rows, columns; | - |
| 990 | QVector<QMap<int, QVariant> > data; | - |
| 991 | | - |
| 992 | while (!stream.atEnd()) { evaluated: !stream.atEnd()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 993 | int r, c; | - |
| 994 | QMap<int, QVariant> v; | - |
| 995 | stream >> r >> c >> v; | - |
| 996 | rows.append(r); | - |
| 997 | columns.append(c); | - |
| 998 | data.append(v); | - |
| 999 | top = qMin(r, top); | - |
| 1000 | left = qMin(c, left); | - |
| 1001 | bottom = qMax(r, bottom); | - |
| 1002 | right = qMax(c, right); | - |
| 1003 | } executed: }Execution Count:46 | 46 |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | int dragRowCount = 0; | - |
| 1008 | int dragColumnCount = right - left + 1; | - |
| 1009 | | - |
| 1010 | | - |
| 1011 | QVector<int> rowsToInsert(bottom + 1); | - |
| 1012 | for (int i = 0; i < rows.count(); ++i) evaluated: i < rows.count()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 1013 | rowsToInsert[rows.at(i)] = 1; executed: rowsToInsert[rows.at(i)] = 1;Execution Count:46 | 46 |
| 1014 | for (int i = 0; i < rowsToInsert.count(); ++i) { evaluated: i < rowsToInsert.count()| yes Evaluation Count:24 | yes Evaluation Count:12 |
| 12-24 |
| 1015 | if (rowsToInsert[i] == 1){ evaluated: rowsToInsert[i] == 1| yes Evaluation Count:22 | yes Evaluation Count:2 |
| 2-22 |
| 1016 | rowsToInsert[i] = dragRowCount; | - |
| 1017 | ++dragRowCount; | - |
| 1018 | } executed: }Execution Count:22 | 22 |
| 1019 | } executed: }Execution Count:24 | 24 |
| 1020 | for (int i = 0; i < rows.count(); ++i) evaluated: i < rows.count()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 1021 | rows[i] = top + rowsToInsert[rows[i]]; executed: rows[i] = top + rowsToInsert[rows[i]];Execution Count:46 | 46 |
| 1022 | | - |
| 1023 | QBitArray isWrittenTo(dragRowCount * dragColumnCount); | - |
| 1024 | | - |
| 1025 | | - |
| 1026 | int colCount = columnCount(parent); | - |
| 1027 | if (colCount == 0) { partially evaluated: colCount == 0| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 1028 | insertColumns(colCount, dragColumnCount - colCount, parent); | - |
| 1029 | colCount = columnCount(parent); | - |
| 1030 | } | 0 |
| 1031 | insertRows(row, dragRowCount, parent); | - |
| 1032 | | - |
| 1033 | row = qMax(0, row); | - |
| 1034 | column = qMax(0, column); | - |
| 1035 | | - |
| 1036 | QVector<QPersistentModelIndex> newIndexes(data.size()); | - |
| 1037 | | - |
| 1038 | for (int j = 0; j < data.size(); ++j) { evaluated: j < data.size()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 1039 | int relativeRow = rows.at(j) - top; | - |
| 1040 | int relativeColumn = columns.at(j) - left; | - |
| 1041 | int destinationRow = relativeRow + row; | - |
| 1042 | int destinationColumn = relativeColumn + column; | - |
| 1043 | int flat = (relativeRow * dragColumnCount) + relativeColumn; | - |
| 1044 | | - |
| 1045 | if (destinationColumn >= colCount || isWrittenTo.testBit(flat)) { evaluated: destinationColumn >= colCount| yes Evaluation Count:9 | yes Evaluation Count:37 |
evaluated: isWrittenTo.testBit(flat)| yes Evaluation Count:3 | yes Evaluation Count:34 |
| 3-37 |
| 1046 | destinationColumn = qBound(column, destinationColumn, colCount - 1); | - |
| 1047 | destinationRow = row + dragRowCount; | - |
| 1048 | insertRows(row + dragRowCount, 1, parent); | - |
| 1049 | flat = (dragRowCount * dragColumnCount) + relativeColumn; | - |
| 1050 | isWrittenTo.resize(++dragRowCount * dragColumnCount); | - |
| 1051 | } executed: }Execution Count:12 | 12 |
| 1052 | if (!isWrittenTo.testBit(flat)) { partially evaluated: !isWrittenTo.testBit(flat)| yes Evaluation Count:46 | no Evaluation Count:0 |
| 0-46 |
| 1053 | newIndexes[j] = index(destinationRow, destinationColumn, parent); | - |
| 1054 | isWrittenTo.setBit(flat); | - |
| 1055 | } executed: }Execution Count:46 | 46 |
| 1056 | } executed: }Execution Count:46 | 46 |
| 1057 | | - |
| 1058 | for(int k = 0; k < newIndexes.size(); k++) { evaluated: k < newIndexes.size()| yes Evaluation Count:46 | yes Evaluation Count:12 |
| 12-46 |
| 1059 | if (newIndexes.at(k).isValid()) partially evaluated: newIndexes.at(k).isValid()| yes Evaluation Count:46 | no Evaluation Count:0 |
| 0-46 |
| 1060 | setItemData(newIndexes.at(k), data.at(k)); executed: setItemData(newIndexes.at(k), data.at(k));Execution Count:46 | 46 |
| 1061 | } executed: }Execution Count:46 | 46 |
| 1062 | | - |
| 1063 | return true; executed: return true;Execution Count:12 | 12 |
| 1064 | } | - |
| 1065 | void QAbstractItemModel::beginInsertRows(const QModelIndex &parent, int first, int last) | - |
| 1066 | { | - |
| 1067 | qt_noop(); | - |
| 1068 | qt_noop(); | - |
| 1069 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1070 | d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last)); | - |
| 1071 | rowsAboutToBeInserted(parent, first, last, QPrivateSignal()); | - |
| 1072 | d->rowsAboutToBeInserted(parent, first, last); | - |
| 1073 | } executed: }Execution Count:110533 | 110533 |
| 1074 | void QAbstractItemModel::endInsertRows() | - |
| 1075 | { | - |
| 1076 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1077 | QAbstractItemModelPrivate::Change change = d->changes.pop(); | - |
| 1078 | d->rowsInserted(change.parent, change.first, change.last); | - |
| 1079 | rowsInserted(change.parent, change.first, change.last, QPrivateSignal()); | - |
| 1080 | } executed: }Execution Count:110533 | 110533 |
| 1081 | void QAbstractItemModel::beginRemoveRows(const QModelIndex &parent, int first, int last) | - |
| 1082 | { | - |
| 1083 | qt_noop(); | - |
| 1084 | qt_noop(); | - |
| 1085 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1086 | d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last)); | - |
| 1087 | rowsAboutToBeRemoved(parent, first, last, QPrivateSignal()); | - |
| 1088 | d->rowsAboutToBeRemoved(parent, first, last); | - |
| 1089 | } executed: }Execution Count:1998 | 1998 |
| 1090 | void QAbstractItemModel::endRemoveRows() | - |
| 1091 | { | - |
| 1092 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1093 | QAbstractItemModelPrivate::Change change = d->changes.pop(); | - |
| 1094 | d->rowsRemoved(change.parent, change.first, change.last); | - |
| 1095 | rowsRemoved(change.parent, change.first, change.last, QPrivateSignal()); | - |
| 1096 | } executed: }Execution Count:1998 | 1998 |
| 1097 | bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int start, int end, const QModelIndex &destinationParent, int destinationStart, Qt::Orientation orientation) | - |
| 1098 | { | - |
| 1099 | | - |
| 1100 | if (destinationParent == srcParent) evaluated: destinationParent == srcParent| yes Evaluation Count:43 | yes Evaluation Count:106 |
| 43-106 |
| 1101 | return !(destinationStart >= start && destinationStart <= end + 1); executed: return !(destinationStart >= start && destinationStart <= end + 1);Execution Count:43 | 43 |
| 1102 | | - |
| 1103 | QModelIndex destinationAncestor = destinationParent; | - |
| 1104 | int pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); partially evaluated: (Qt::Vertical == orientation)| yes Evaluation Count:106 | no Evaluation Count:0 |
| 0-106 |
| 1105 | for(;;) { | - |
| 1106 | if (destinationAncestor == srcParent) { evaluated: destinationAncestor == srcParent| yes Evaluation Count:75 | yes Evaluation Count:270 |
| 75-270 |
| 1107 | if (pos >= start && pos <= end) evaluated: pos >= start| yes Evaluation Count:67 | yes Evaluation Count:8 |
evaluated: pos <= end| yes Evaluation Count:60 | yes Evaluation Count:7 |
| 7-67 |
| 1108 | return false; executed: return false;Execution Count:60 | 60 |
| 1109 | break; executed: break;Execution Count:15 | 15 |
| 1110 | } | - |
| 1111 | | - |
| 1112 | if (!destinationAncestor.isValid()) evaluated: !destinationAncestor.isValid()| yes Evaluation Count:31 | yes Evaluation Count:239 |
| 31-239 |
| 1113 | break; executed: break;Execution Count:31 | 31 |
| 1114 | | - |
| 1115 | pos = (Qt::Vertical == orientation) ? destinationAncestor.row() : destinationAncestor.column(); partially evaluated: (Qt::Vertical == orientation)| yes Evaluation Count:239 | no Evaluation Count:0 |
| 0-239 |
| 1116 | destinationAncestor = destinationAncestor.parent(); | - |
| 1117 | } executed: }Execution Count:239 | 239 |
| 1118 | | - |
| 1119 | return true; executed: return true;Execution Count:46 | 46 |
| 1120 | } | - |
| 1121 | bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) | - |
| 1122 | { | - |
| 1123 | qt_noop(); | - |
| 1124 | qt_noop(); | - |
| 1125 | qt_noop(); | - |
| 1126 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1127 | | - |
| 1128 | if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical)) { evaluated: !d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical)| yes Evaluation Count:85 | yes Evaluation Count:63 |
| 63-85 |
| 1129 | return false; executed: return false;Execution Count:85 | 85 |
| 1130 | } | - |
| 1131 | | - |
| 1132 | QAbstractItemModelPrivate::Change sourceChange(sourceParent, sourceFirst, sourceLast); | - |
| 1133 | sourceChange.needsAdjust = sourceParent.isValid() && sourceParent.row() >= destinationChild && sourceParent.parent() == destinationParent; evaluated: sourceParent.isValid()| yes Evaluation Count:39 | yes Evaluation Count:24 |
evaluated: sourceParent.row() >= destinationChild| yes Evaluation Count:25 | yes Evaluation Count:14 |
evaluated: sourceParent.parent() == destinationParent| yes Evaluation Count:10 | yes Evaluation Count:15 |
| 10-39 |
| 1134 | d->changes.push(sourceChange); | - |
| 1135 | int destinationLast = destinationChild + (sourceLast - sourceFirst); | - |
| 1136 | QAbstractItemModelPrivate::Change destinationChange(destinationParent, destinationChild, destinationLast); | - |
| 1137 | destinationChange.needsAdjust = destinationParent.isValid() && destinationParent.row() >= sourceLast && destinationParent.parent() == sourceParent; evaluated: destinationParent.isValid()| yes Evaluation Count:37 | yes Evaluation Count:26 |
evaluated: destinationParent.row() >= sourceLast| yes Evaluation Count:16 | yes Evaluation Count:21 |
evaluated: destinationParent.parent() == sourceParent| yes Evaluation Count:7 | yes Evaluation Count:9 |
| 7-37 |
| 1138 | d->changes.push(destinationChange); | - |
| 1139 | | - |
| 1140 | rowsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, QPrivateSignal()); | - |
| 1141 | d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Vertical); | - |
| 1142 | return true; executed: return true;Execution Count:63 | 63 |
| 1143 | } | - |
| 1144 | void QAbstractItemModel::endMoveRows() | - |
| 1145 | { | - |
| 1146 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1147 | | - |
| 1148 | QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); | - |
| 1149 | QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); | - |
| 1150 | | - |
| 1151 | QModelIndex adjustedSource = removeChange.parent; | - |
| 1152 | QModelIndex adjustedDestination = insertChange.parent; | - |
| 1153 | | - |
| 1154 | const int numMoved = removeChange.last - removeChange.first + 1; | - |
| 1155 | if (insertChange.needsAdjust) evaluated: insertChange.needsAdjust| yes Evaluation Count:7 | yes Evaluation Count:56 |
| 7-56 |
| 1156 | adjustedDestination = createIndex(adjustedDestination.row() - numMoved, adjustedDestination.column(), adjustedDestination.internalPointer()); executed: adjustedDestination = createIndex(adjustedDestination.row() - numMoved, adjustedDestination.column(), adjustedDestination.internalPointer());Execution Count:7 | 7 |
| 1157 | | - |
| 1158 | if (removeChange.needsAdjust) evaluated: removeChange.needsAdjust| yes Evaluation Count:10 | yes Evaluation Count:53 |
| 10-53 |
| 1159 | adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer()); executed: adjustedSource = createIndex(adjustedSource.row() + numMoved, adjustedSource.column(), adjustedSource.internalPointer());Execution Count:10 | 10 |
| 1160 | | - |
| 1161 | d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Vertical); | - |
| 1162 | | - |
| 1163 | rowsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, QPrivateSignal()); | - |
| 1164 | } executed: }Execution Count:63 | 63 |
| 1165 | void QAbstractItemModel::beginInsertColumns(const QModelIndex &parent, int first, int last) | - |
| 1166 | { | - |
| 1167 | qt_noop(); | - |
| 1168 | qt_noop(); | - |
| 1169 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1170 | d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last)); | - |
| 1171 | columnsAboutToBeInserted(parent, first, last, QPrivateSignal()); | - |
| 1172 | d->columnsAboutToBeInserted(parent, first, last); | - |
| 1173 | } executed: }Execution Count:10811 | 10811 |
| 1174 | void QAbstractItemModel::endInsertColumns() | - |
| 1175 | { | - |
| 1176 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1177 | QAbstractItemModelPrivate::Change change = d->changes.pop(); | - |
| 1178 | d->columnsInserted(change.parent, change.first, change.last); | - |
| 1179 | columnsInserted(change.parent, change.first, change.last, QPrivateSignal()); | - |
| 1180 | } executed: }Execution Count:10811 | 10811 |
| 1181 | void QAbstractItemModel::beginRemoveColumns(const QModelIndex &parent, int first, int last) | - |
| 1182 | { | - |
| 1183 | qt_noop(); | - |
| 1184 | qt_noop(); | - |
| 1185 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1186 | d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last)); | - |
| 1187 | columnsAboutToBeRemoved(parent, first, last, QPrivateSignal()); | - |
| 1188 | d->columnsAboutToBeRemoved(parent, first, last); | - |
| 1189 | } executed: }Execution Count:204 | 204 |
| 1190 | void QAbstractItemModel::endRemoveColumns() | - |
| 1191 | { | - |
| 1192 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1193 | QAbstractItemModelPrivate::Change change = d->changes.pop(); | - |
| 1194 | d->columnsRemoved(change.parent, change.first, change.last); | - |
| 1195 | columnsRemoved(change.parent, change.first, change.last, QPrivateSignal()); | - |
| 1196 | } executed: }Execution Count:204 | 204 |
| 1197 | bool QAbstractItemModel::beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) | - |
| 1198 | { | - |
| 1199 | qt_noop(); | - |
| 1200 | qt_noop(); | - |
| 1201 | qt_noop(); | - |
| 1202 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1203 | | - |
| 1204 | if (!d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal)) { partially evaluated: !d->allowMove(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1205 | return false; never executed: return false; | 0 |
| 1206 | } | - |
| 1207 | | - |
| 1208 | QAbstractItemModelPrivate::Change sourceChange(sourceParent, sourceFirst, sourceLast); | - |
| 1209 | sourceChange.needsAdjust = sourceParent.isValid() && sourceParent.row() >= destinationChild && sourceParent.parent() == destinationParent; partially evaluated: sourceParent.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: sourceParent.row() >= destinationChild never evaluated: sourceParent.parent() == destinationParent | 0-1 |
| 1210 | d->changes.push(sourceChange); | - |
| 1211 | int destinationLast = destinationChild + (sourceLast - sourceFirst); | - |
| 1212 | QAbstractItemModelPrivate::Change destinationChange(destinationParent, destinationChild, destinationLast); | - |
| 1213 | destinationChange.needsAdjust = destinationParent.isValid() && destinationParent.row() >= sourceLast && destinationParent.parent() == sourceParent; partially evaluated: destinationParent.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: destinationParent.row() >= sourceLast never evaluated: destinationParent.parent() == sourceParent | 0-1 |
| 1214 | d->changes.push(destinationChange); | - |
| 1215 | | - |
| 1216 | d->itemsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, Qt::Horizontal); | - |
| 1217 | | - |
| 1218 | columnsAboutToBeMoved(sourceParent, sourceFirst, sourceLast, destinationParent, destinationChild, QPrivateSignal()); | - |
| 1219 | return true; executed: return true;Execution Count:1 | 1 |
| 1220 | } | - |
| 1221 | void QAbstractItemModel::endMoveColumns() | - |
| 1222 | { | - |
| 1223 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1224 | | - |
| 1225 | QAbstractItemModelPrivate::Change insertChange = d->changes.pop(); | - |
| 1226 | QAbstractItemModelPrivate::Change removeChange = d->changes.pop(); | - |
| 1227 | | - |
| 1228 | QModelIndex adjustedSource = removeChange.parent; | - |
| 1229 | QModelIndex adjustedDestination = insertChange.parent; | - |
| 1230 | | - |
| 1231 | const int numMoved = removeChange.last - removeChange.first + 1; | - |
| 1232 | if (insertChange.needsAdjust) partially evaluated: insertChange.needsAdjust| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1233 | adjustedDestination = createIndex(adjustedDestination.row(), adjustedDestination.column() - numMoved, adjustedDestination.internalPointer()); never executed: adjustedDestination = createIndex(adjustedDestination.row(), adjustedDestination.column() - numMoved, adjustedDestination.internalPointer()); | 0 |
| 1234 | | - |
| 1235 | if (removeChange.needsAdjust) partially evaluated: removeChange.needsAdjust| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1236 | adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer()); never executed: adjustedSource = createIndex(adjustedSource.row(), adjustedSource.column() + numMoved, adjustedSource.internalPointer()); | 0 |
| 1237 | | - |
| 1238 | d->itemsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, Qt::Horizontal); | - |
| 1239 | | - |
| 1240 | columnsMoved(adjustedSource, removeChange.first, removeChange.last, adjustedDestination, insertChange.first, QPrivateSignal()); | - |
| 1241 | } executed: }Execution Count:1 | 1 |
| 1242 | void QAbstractItemModel::beginResetModel() | - |
| 1243 | { | - |
| 1244 | modelAboutToBeReset(QPrivateSignal()); | - |
| 1245 | } executed: }Execution Count:6861 | 6861 |
| 1246 | void QAbstractItemModel::endResetModel() | - |
| 1247 | { | - |
| 1248 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1249 | d->invalidatePersistentIndexes(); | - |
| 1250 | modelReset(QPrivateSignal()); | - |
| 1251 | } executed: }Execution Count:6860 | 6860 |
| 1252 | void QAbstractItemModel::changePersistentIndex(const QModelIndex &from, const QModelIndex &to) | - |
| 1253 | { | - |
| 1254 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1255 | if (d->persistent.indexes.isEmpty()) partially evaluated: d->persistent.indexes.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 1256 | return; | 0 |
| 1257 | | - |
| 1258 | const QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = d->persistent.indexes.find(from); | - |
| 1259 | if (it != d->persistent.indexes.end()) { partially evaluated: it != d->persistent.indexes.end()| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 1260 | QPersistentModelIndexData *data = *it; | - |
| 1261 | d->persistent.indexes.erase(it); | - |
| 1262 | data->index = to; | - |
| 1263 | if (to.isValid()) partially evaluated: to.isValid()| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 1264 | d->persistent.insertMultiAtEnd(to, data); executed: d->persistent.insertMultiAtEnd(to, data);Execution Count:12 | 12 |
| 1265 | else | - |
| 1266 | data->model = 0; never executed: data->model = 0; | 0 |
| 1267 | } | - |
| 1268 | } executed: }Execution Count:12 | 12 |
| 1269 | void QAbstractItemModel::changePersistentIndexList(const QModelIndexList &from, | - |
| 1270 | const QModelIndexList &to) | - |
| 1271 | { | - |
| 1272 | QAbstractItemModelPrivate * const d = d_func(); | - |
| 1273 | if (d->persistent.indexes.isEmpty()) evaluated: d->persistent.indexes.isEmpty()| yes Evaluation Count:4523 | yes Evaluation Count:556 |
| 556-4523 |
| 1274 | return; executed: return;Execution Count:4523 | 4523 |
| 1275 | QVector<QPersistentModelIndexData *> toBeReinserted; | - |
| 1276 | toBeReinserted.reserve(to.count()); | - |
| 1277 | for (int i = 0; i < from.count(); ++i) { evaluated: i < from.count()| yes Evaluation Count:1194 | yes Evaluation Count:556 |
| 556-1194 |
| 1278 | if (from.at(i) == to.at(i)) evaluated: from.at(i) == to.at(i)| yes Evaluation Count:592 | yes Evaluation Count:602 |
| 592-602 |
| 1279 | continue; executed: continue;Execution Count:592 | 592 |
| 1280 | const QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = d->persistent.indexes.find(from.at(i)); | - |
| 1281 | if (it != d->persistent.indexes.end()) { evaluated: it != d->persistent.indexes.end()| yes Evaluation Count:476 | yes Evaluation Count:126 |
| 126-476 |
| 1282 | QPersistentModelIndexData *data = *it; | - |
| 1283 | d->persistent.indexes.erase(it); | - |
| 1284 | data->index = to.at(i); | - |
| 1285 | if (data->index.isValid()) partially evaluated: data->index.isValid()| yes Evaluation Count:476 | no Evaluation Count:0 |
| 0-476 |
| 1286 | toBeReinserted << data; executed: toBeReinserted << data;Execution Count:476 | 476 |
| 1287 | else | - |
| 1288 | data->model = 0; never executed: data->model = 0; | 0 |
| 1289 | } | - |
| 1290 | } executed: }Execution Count:602 | 602 |
| 1291 | | - |
| 1292 | for (QVector<QPersistentModelIndexData *>::const_iterator it = toBeReinserted.constBegin(); | - |
| 1293 | it != toBeReinserted.constEnd() ; ++it) { evaluated: it != toBeReinserted.constEnd()| yes Evaluation Count:476 | yes Evaluation Count:556 |
| 476-556 |
| 1294 | QPersistentModelIndexData *data = *it; | - |
| 1295 | d->persistent.insertMultiAtEnd(data->index, data); | - |
| 1296 | } executed: }Execution Count:476 | 476 |
| 1297 | } executed: }Execution Count:556 | 556 |
| 1298 | | - |
| 1299 | | - |
| 1300 | | - |
| 1301 | | - |
| 1302 | | - |
| 1303 | | - |
| 1304 | QModelIndexList QAbstractItemModel::persistentIndexList() const | - |
| 1305 | { | - |
| 1306 | const QAbstractItemModelPrivate * const d = d_func(); | - |
| 1307 | QModelIndexList result; | - |
| 1308 | for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = d->persistent.indexes.constBegin(); | - |
| 1309 | it != d->persistent.indexes.constEnd(); ++it) { evaluated: it != d->persistent.indexes.constEnd()| yes Evaluation Count:560 | yes Evaluation Count:793 |
| 560-793 |
| 1310 | QPersistentModelIndexData *data = *it; | - |
| 1311 | result.append(data->index); | - |
| 1312 | } executed: }Execution Count:560 | 560 |
| 1313 | return result; executed: return result;Execution Count:793 | 793 |
| 1314 | } | - |
| 1315 | QAbstractTableModel::QAbstractTableModel(QObject *parent) | - |
| 1316 | : QAbstractItemModel(parent) | - |
| 1317 | { | - |
| 1318 | | - |
| 1319 | } executed: }Execution Count:405 | 405 |
| 1320 | | - |
| 1321 | | - |
| 1322 | | - |
| 1323 | | - |
| 1324 | | - |
| 1325 | | - |
| 1326 | | - |
| 1327 | QAbstractTableModel::QAbstractTableModel(QAbstractItemModelPrivate &dd, QObject *parent) | - |
| 1328 | : QAbstractItemModel(dd, parent) | - |
| 1329 | { | - |
| 1330 | | - |
| 1331 | } executed: }Execution Count:287 | 287 |
| 1332 | | - |
| 1333 | | - |
| 1334 | | - |
| 1335 | | - |
| 1336 | | - |
| 1337 | QAbstractTableModel::~QAbstractTableModel() | - |
| 1338 | { | - |
| 1339 | | - |
| 1340 | } | - |
| 1341 | QModelIndex QAbstractTableModel::index(int row, int column, const QModelIndex &parent) const | - |
| 1342 | { | - |
| 1343 | return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex(); executed: return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex();Execution Count:55659 | 55659 |
| 1344 | } | - |
| 1345 | QModelIndex QAbstractTableModel::parent(const QModelIndex &) const | - |
| 1346 | { | - |
| 1347 | return QModelIndex(); executed: return QModelIndex();Execution Count:42276 | 42276 |
| 1348 | } | - |
| 1349 | | - |
| 1350 | bool QAbstractTableModel::hasChildren(const QModelIndex &parent) const | - |
| 1351 | { | - |
| 1352 | if (parent.model() == this || !parent.isValid()) evaluated: parent.model() == this| yes Evaluation Count:2453 | yes Evaluation Count:254 |
partially evaluated: !parent.isValid()| yes Evaluation Count:254 | no Evaluation Count:0 |
| 0-2453 |
| 1353 | return rowCount(parent) > 0 && columnCount(parent) > 0; executed: return rowCount(parent) > 0 && columnCount(parent) > 0;Execution Count:2707 | 2707 |
| 1354 | return false; never executed: return false; | 0 |
| 1355 | } | - |
| 1356 | QAbstractListModel::QAbstractListModel(QObject *parent) | - |
| 1357 | : QAbstractItemModel(parent) | - |
| 1358 | { | - |
| 1359 | | - |
| 1360 | } executed: }Execution Count:503 | 503 |
| 1361 | | - |
| 1362 | | - |
| 1363 | | - |
| 1364 | | - |
| 1365 | | - |
| 1366 | | - |
| 1367 | | - |
| 1368 | QAbstractListModel::QAbstractListModel(QAbstractItemModelPrivate &dd, QObject *parent) | - |
| 1369 | : QAbstractItemModel(dd, parent) | - |
| 1370 | { | - |
| 1371 | | - |
| 1372 | } | 0 |
| 1373 | | - |
| 1374 | | - |
| 1375 | | - |
| 1376 | | - |
| 1377 | | - |
| 1378 | QAbstractListModel::~QAbstractListModel() | - |
| 1379 | { | - |
| 1380 | | - |
| 1381 | } | - |
| 1382 | QModelIndex QAbstractListModel::index(int row, int column, const QModelIndex &parent) const | - |
| 1383 | { | - |
| 1384 | return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex(); executed: return hasIndex(row, column, parent) ? createIndex(row, column) : QModelIndex();Execution Count:92779 | 92779 |
| 1385 | } | - |
| 1386 | | - |
| 1387 | | - |
| 1388 | | - |
| 1389 | | - |
| 1390 | | - |
| 1391 | | - |
| 1392 | | - |
| 1393 | QModelIndex QAbstractListModel::parent(const QModelIndex & ) const | - |
| 1394 | { | - |
| 1395 | return QModelIndex(); executed: return QModelIndex();Execution Count:32744 | 32744 |
| 1396 | } | - |
| 1397 | int QAbstractListModel::columnCount(const QModelIndex &parent) const | - |
| 1398 | { | - |
| 1399 | return parent.isValid() ? 0 : 1; executed: return parent.isValid() ? 0 : 1;Execution Count:88191 | 88191 |
| 1400 | } | - |
| 1401 | | - |
| 1402 | bool QAbstractListModel::hasChildren(const QModelIndex &parent) const | - |
| 1403 | { | - |
| 1404 | return parent.isValid() ? false : (rowCount() > 0); executed: return parent.isValid() ? false : (rowCount() > 0);Execution Count:502 | 502 |
| 1405 | } | - |
| 1406 | bool QAbstractTableModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - |
| 1407 | int row, int column, const QModelIndex &parent) | - |
| 1408 | { | - |
| 1409 | if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction)) never evaluated: action == Qt::CopyAction never evaluated: action == Qt::MoveAction | 0 |
| 1410 | return false; never executed: return false; | 0 |
| 1411 | | - |
| 1412 | QStringList types = mimeTypes(); | - |
| 1413 | if (types.isEmpty()) never evaluated: types.isEmpty() | 0 |
| 1414 | return false; never executed: return false; | 0 |
| 1415 | QString format = types.at(0); | - |
| 1416 | if (!data->hasFormat(format)) never evaluated: !data->hasFormat(format) | 0 |
| 1417 | return false; never executed: return false; | 0 |
| 1418 | | - |
| 1419 | QByteArray encoded = data->data(format); | - |
| 1420 | QDataStream stream(&encoded, QIODevice::ReadOnly); | - |
| 1421 | | - |
| 1422 | | - |
| 1423 | if (parent.isValid() && row == -1 && column == -1) { never evaluated: parent.isValid() never evaluated: row == -1 never evaluated: column == -1 | 0 |
| 1424 | int top = 2147483647; | - |
| 1425 | int left = 2147483647; | - |
| 1426 | QVector<int> rows, columns; | - |
| 1427 | QVector<QMap<int, QVariant> > data; | - |
| 1428 | | - |
| 1429 | while (!stream.atEnd()) { never evaluated: !stream.atEnd() | 0 |
| 1430 | int r, c; | - |
| 1431 | QMap<int, QVariant> v; | - |
| 1432 | stream >> r >> c >> v; | - |
| 1433 | rows.append(r); | - |
| 1434 | columns.append(c); | - |
| 1435 | data.append(v); | - |
| 1436 | top = qMin(r, top); | - |
| 1437 | left = qMin(c, left); | - |
| 1438 | } | 0 |
| 1439 | | - |
| 1440 | for (int i = 0; i < data.size(); ++i) { never evaluated: i < data.size() | 0 |
| 1441 | int r = (rows.at(i) - top) + parent.row(); | - |
| 1442 | int c = (columns.at(i) - left) + parent.column(); | - |
| 1443 | if (hasIndex(r, c)) never evaluated: hasIndex(r, c) | 0 |
| 1444 | setItemData(index(r, c), data.at(i)); never executed: setItemData(index(r, c), data.at(i)); | 0 |
| 1445 | } | 0 |
| 1446 | | - |
| 1447 | return true; never executed: return true; | 0 |
| 1448 | } | - |
| 1449 | | - |
| 1450 | | - |
| 1451 | return decodeData(row, column, parent, stream); never executed: return decodeData(row, column, parent, stream); | 0 |
| 1452 | } | - |
| 1453 | | - |
| 1454 | | - |
| 1455 | | - |
| 1456 | | - |
| 1457 | bool QAbstractListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - |
| 1458 | int row, int column, const QModelIndex &parent) | - |
| 1459 | { | - |
| 1460 | if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction)) never evaluated: action == Qt::CopyAction never evaluated: action == Qt::MoveAction | 0 |
| 1461 | return false; never executed: return false; | 0 |
| 1462 | | - |
| 1463 | QStringList types = mimeTypes(); | - |
| 1464 | if (types.isEmpty()) never evaluated: types.isEmpty() | 0 |
| 1465 | return false; never executed: return false; | 0 |
| 1466 | QString format = types.at(0); | - |
| 1467 | if (!data->hasFormat(format)) never evaluated: !data->hasFormat(format) | 0 |
| 1468 | return false; never executed: return false; | 0 |
| 1469 | | - |
| 1470 | QByteArray encoded = data->data(format); | - |
| 1471 | QDataStream stream(&encoded, QIODevice::ReadOnly); | - |
| 1472 | | - |
| 1473 | | - |
| 1474 | if (parent.isValid() && row == -1 && column == -1) { never evaluated: parent.isValid() never evaluated: row == -1 never evaluated: column == -1 | 0 |
| 1475 | int top = 2147483647; | - |
| 1476 | int left = 2147483647; | - |
| 1477 | QVector<int> rows, columns; | - |
| 1478 | QVector<QMap<int, QVariant> > data; | - |
| 1479 | | - |
| 1480 | while (!stream.atEnd()) { never evaluated: !stream.atEnd() | 0 |
| 1481 | int r, c; | - |
| 1482 | QMap<int, QVariant> v; | - |
| 1483 | stream >> r >> c >> v; | - |
| 1484 | rows.append(r); | - |
| 1485 | columns.append(c); | - |
| 1486 | data.append(v); | - |
| 1487 | top = qMin(r, top); | - |
| 1488 | left = qMin(c, left); | - |
| 1489 | } | 0 |
| 1490 | | - |
| 1491 | for (int i = 0; i < data.size(); ++i) { never evaluated: i < data.size() | 0 |
| 1492 | int r = (rows.at(i) - top) + parent.row(); | - |
| 1493 | if (columns.at(i) == left && hasIndex(r, 0)) never evaluated: columns.at(i) == left never evaluated: hasIndex(r, 0) | 0 |
| 1494 | setItemData(index(r), data.at(i)); never executed: setItemData(index(r), data.at(i)); | 0 |
| 1495 | } | 0 |
| 1496 | | - |
| 1497 | return true; never executed: return true; | 0 |
| 1498 | } | - |
| 1499 | | - |
| 1500 | if (row == -1) never evaluated: row == -1 | 0 |
| 1501 | row = rowCount(parent); never executed: row = rowCount(parent); | 0 |
| 1502 | | - |
| 1503 | | - |
| 1504 | return decodeData(row, column, parent, stream); never executed: return decodeData(row, column, parent, stream); | 0 |
| 1505 | } | - |
| 1506 | void QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(const QModelIndex& key, QPersistentModelIndexData *data) | - |
| 1507 | { | - |
| 1508 | QHash<QModelIndex,QPersistentModelIndexData *>::iterator newIt = | - |
| 1509 | indexes.insertMulti(key, data); | - |
| 1510 | QHash<QModelIndex,QPersistentModelIndexData *>::iterator it = newIt + 1; | - |
| 1511 | while (it != indexes.end() && it.key() == key) { evaluated: it != indexes.end()| yes Evaluation Count:6405 | yes Evaluation Count:2461 |
evaluated: it.key() == key| yes Evaluation Count:16 | yes Evaluation Count:6389 |
| 16-6405 |
| 1512 | qSwap(*newIt,*it); | - |
| 1513 | newIt = it; | - |
| 1514 | ++it; | - |
| 1515 | } executed: }Execution Count:16 | 16 |
| 1516 | } executed: }Execution Count:8850 | 8850 |
| 1517 | | - |
| 1518 | | - |
| 1519 | | - |
| | |