| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/itemmodels/qidentityproxymodel.cpp | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||
| 2 | ** | - | ||||||||||||
| 3 | ** Copyright (C) 2011 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> | - | ||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||
| 5 | ** | - | ||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||
| 7 | ** | - | ||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||
| 16 | ** | - | ||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||
| 24 | ** | - | ||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||
| 35 | ** | - | ||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||
| 37 | ** | - | ||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | #include "qidentityproxymodel.h" | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | #ifndef QT_NO_IDENTITYPROXYMODEL | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | #include "qitemselectionmodel.h" | - | ||||||||||||
| 45 | #include <private/qabstractproxymodel_p.h> | - | ||||||||||||
| 46 | - | |||||||||||||
| 47 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | class QIdentityProxyModelPrivate : public QAbstractProxyModelPrivate | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | QIdentityProxyModelPrivate() | - | ||||||||||||
| 52 | { | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | } | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | Q_DECLARE_PUBLIC(QIdentityProxyModel) | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | QList<QPersistentModelIndex> layoutChangePersistentIndexes; | - | ||||||||||||
| 59 | QModelIndexList proxyIndexes; | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | void _q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 62 | void _q_sourceRowsInserted(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 63 | void _q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 64 | void _q_sourceRowsRemoved(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 65 | void _q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); | - | ||||||||||||
| 66 | void _q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); | - | ||||||||||||
| 67 | - | |||||||||||||
| 68 | void _q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 69 | void _q_sourceColumnsInserted(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 70 | void _q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 71 | void _q_sourceColumnsRemoved(const QModelIndex &parent, int start, int end); | - | ||||||||||||
| 72 | void _q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); | - | ||||||||||||
| 73 | void _q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest); | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | void _q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles); | - | ||||||||||||
| 76 | void _q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last); | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | void _q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); | - | ||||||||||||
| 79 | void _q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint); | - | ||||||||||||
| 80 | void _q_sourceModelAboutToBeReset(); | - | ||||||||||||
| 81 | void _q_sourceModelReset(); | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | }; | - | ||||||||||||
| 84 | - | |||||||||||||
| 85 | /*! | - | ||||||||||||
| 86 | \since 4.8 | - | ||||||||||||
| 87 | \class QIdentityProxyModel | - | ||||||||||||
| 88 | \inmodule QtCore | - | ||||||||||||
| 89 | \brief The QIdentityProxyModel class proxies its source model unmodified | - | ||||||||||||
| 90 | - | |||||||||||||
| 91 | \ingroup model-view | - | ||||||||||||
| 92 | - | |||||||||||||
| 93 | QIdentityProxyModel can be used to forward the structure of a source model exactly, with no sorting, filtering or other transformation. | - | ||||||||||||
| 94 | This is similar in concept to an identity matrix where A.I = A. | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | Because it does no sorting or filtering, this class is most suitable to proxy models which transform the data() of the source model. | - | ||||||||||||
| 97 | For example, a proxy model could be created to define the font used, or the background colour, or the tooltip etc. This removes the | - | ||||||||||||
| 98 | need to implement all data handling in the same class that creates the structure of the model, and can also be used to create | - | ||||||||||||
| 99 | re-usable components. | - | ||||||||||||
| 100 | - | |||||||||||||
| 101 | This also provides a way to change the data in the case where a source model is supplied by a third party which can not be modified. | - | ||||||||||||
| 102 | - | |||||||||||||
| 103 | \snippet code/src_gui_itemviews_qidentityproxymodel.cpp 0 | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | \sa QAbstractProxyModel, {Model/View Programming}, QAbstractItemModel | - | ||||||||||||
| 106 | - | |||||||||||||
| 107 | */ | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | /*! | - | ||||||||||||
| 110 | Constructs an identity model with the given \a parent. | - | ||||||||||||
| 111 | */ | - | ||||||||||||
| 112 | QIdentityProxyModel::QIdentityProxyModel(QObject* parent) | - | ||||||||||||
| 113 | : QAbstractProxyModel(*new QIdentityProxyModelPrivate, parent) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | } executed 2 times by 1 test:  end of blockExecuted by: 
 | 2 | ||||||||||||
| 117 | - | |||||||||||||
| 118 | /*! | - | ||||||||||||
| 119 | \internal | - | ||||||||||||
| 120 | */ | - | ||||||||||||
| 121 | QIdentityProxyModel::QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent) | - | ||||||||||||
| 122 | : QAbstractProxyModel(dd, parent) | - | ||||||||||||
| 123 | { | - | ||||||||||||
| 124 | - | |||||||||||||
| 125 | } never executed:  end of block | 0 | ||||||||||||
| 126 | - | |||||||||||||
| 127 | /*! | - | ||||||||||||
| 128 | Destroys this identity model. | - | ||||||||||||
| 129 | */ | - | ||||||||||||
| 130 | QIdentityProxyModel::~QIdentityProxyModel() | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | } | - | ||||||||||||
| 133 | - | |||||||||||||
| 134 | /*! | - | ||||||||||||
| 135 | \reimp | - | ||||||||||||
| 136 | */ | - | ||||||||||||
| 137 | int QIdentityProxyModel::columnCount(const QModelIndex& parent) const | - | ||||||||||||
| 138 | { | - | ||||||||||||
| 139 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 140 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 141 | return d->model->columnCount(mapToSource(parent)); executed 31 times by 1 test:  return d->model->columnCount(mapToSource(parent));Executed by: 
 | 31 | ||||||||||||
| 142 | } | - | ||||||||||||
| 143 | - | |||||||||||||
| 144 | /*! | - | ||||||||||||
| 145 | \reimp | - | ||||||||||||
| 146 | */ | - | ||||||||||||
| 147 | bool QIdentityProxyModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) | - | ||||||||||||
| 148 | { | - | ||||||||||||
| 149 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 150 | Q_D(QIdentityProxyModel); | - | ||||||||||||
| 151 | return d->model->dropMimeData(data, action, row, column, mapToSource(parent)); never executed:  return d->model->dropMimeData(data, action, row, column, mapToSource(parent)); | 0 | ||||||||||||
| 152 | } | - | ||||||||||||
| 153 | - | |||||||||||||
| 154 | /*! | - | ||||||||||||
| 155 | \reimp | - | ||||||||||||
| 156 | */ | - | ||||||||||||
| 157 | QModelIndex QIdentityProxyModel::index(int row, int column, const QModelIndex& parent) const | - | ||||||||||||
| 158 | { | - | ||||||||||||
| 159 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 160 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 161 | const QModelIndex sourceParent = mapToSource(parent); | - | ||||||||||||
| 162 | const QModelIndex sourceIndex = d->model->index(row, column, sourceParent); | - | ||||||||||||
| 163 | return mapFromSource(sourceIndex); executed 1 time by 1 test:  return mapFromSource(sourceIndex);Executed by: 
 | 1 | ||||||||||||
| 164 | } | - | ||||||||||||
| 165 | - | |||||||||||||
| 166 | /*! | - | ||||||||||||
| 167 | \reimp | - | ||||||||||||
| 168 | */ | - | ||||||||||||
| 169 | QModelIndex QIdentityProxyModel::sibling(int row, int column, const QModelIndex &idx) const | - | ||||||||||||
| 170 | { | - | ||||||||||||
| 171 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 172 | return mapFromSource(d->model->sibling(row, column, mapToSource(idx))); never executed:  return mapFromSource(d->model->sibling(row, column, mapToSource(idx))); | 0 | ||||||||||||
| 173 | } | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | /*! | - | ||||||||||||
| 176 | \reimp | - | ||||||||||||
| 177 | */ | - | ||||||||||||
| 178 | bool QIdentityProxyModel::insertColumns(int column, int count, const QModelIndex& parent) | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 181 | Q_D(QIdentityProxyModel); | - | ||||||||||||
| 182 | return d->model->insertColumns(column, count, mapToSource(parent)); never executed:  return d->model->insertColumns(column, count, mapToSource(parent)); | 0 | ||||||||||||
| 183 | } | - | ||||||||||||
| 184 | - | |||||||||||||
| 185 | /*! | - | ||||||||||||
| 186 | \reimp | - | ||||||||||||
| 187 | */ | - | ||||||||||||
| 188 | bool QIdentityProxyModel::insertRows(int row, int count, const QModelIndex& parent) | - | ||||||||||||
| 189 | { | - | ||||||||||||
| 190 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 191 | Q_D(QIdentityProxyModel); | - | ||||||||||||
| 192 | return d->model->insertRows(row, count, mapToSource(parent)); never executed:  return d->model->insertRows(row, count, mapToSource(parent)); | 0 | ||||||||||||
| 193 | } | - | ||||||||||||
| 194 | - | |||||||||||||
| 195 | /*! | - | ||||||||||||
| 196 | \reimp | - | ||||||||||||
| 197 | */ | - | ||||||||||||
| 198 | QModelIndex QIdentityProxyModel::mapFromSource(const QModelIndex& sourceIndex) const | - | ||||||||||||
| 199 | { | - | ||||||||||||
| 200 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 201 | if (!d->model || !sourceIndex.isValid()) 
 
 | 0-237 | ||||||||||||
| 202 | return QModelIndex(); executed 65 times by 1 test:  return QModelIndex();Executed by: 
 | 65 | ||||||||||||
| 203 | - | |||||||||||||
| 204 | Q_ASSERT(sourceIndex.model() == d->model); | - | ||||||||||||
| 205 | return createIndex(sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer()); executed 172 times by 1 test:  return createIndex(sourceIndex.row(), sourceIndex.column(), sourceIndex.internalPointer());Executed by: 
 | 172 | ||||||||||||
| 206 | } | - | ||||||||||||
| 207 | - | |||||||||||||
| 208 | /*! | - | ||||||||||||
| 209 | \reimp | - | ||||||||||||
| 210 | */ | - | ||||||||||||
| 211 | QItemSelection QIdentityProxyModel::mapSelectionFromSource(const QItemSelection& selection) const | - | ||||||||||||
| 212 | { | - | ||||||||||||
| 213 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 214 | QItemSelection proxySelection; | - | ||||||||||||
| 215 | - | |||||||||||||
| 216 | if (!d->model) 
 | 0 | ||||||||||||
| 217 | return proxySelection; never executed:  return proxySelection; | 0 | ||||||||||||
| 218 | - | |||||||||||||
| 219 | QItemSelection::const_iterator it = selection.constBegin(); | - | ||||||||||||
| 220 | const QItemSelection::const_iterator end = selection.constEnd(); | - | ||||||||||||
| 221 | proxySelection.reserve(selection.count()); | - | ||||||||||||
| 222 | for ( ; it != end; ++it) { 
 | 0 | ||||||||||||
| 223 | Q_ASSERT(it->model() == d->model); | - | ||||||||||||
| 224 | const QItemSelectionRange range(mapFromSource(it->topLeft()), mapFromSource(it->bottomRight())); | - | ||||||||||||
| 225 | proxySelection.append(range); | - | ||||||||||||
| 226 | } never executed:  end of block | 0 | ||||||||||||
| 227 | - | |||||||||||||
| 228 | return proxySelection; never executed:  return proxySelection; | 0 | ||||||||||||
| 229 | } | - | ||||||||||||
| 230 | - | |||||||||||||
| 231 | /*! | - | ||||||||||||
| 232 | \reimp | - | ||||||||||||
| 233 | */ | - | ||||||||||||
| 234 | QItemSelection QIdentityProxyModel::mapSelectionToSource(const QItemSelection& selection) const | - | ||||||||||||
| 235 | { | - | ||||||||||||
| 236 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 237 | QItemSelection sourceSelection; | - | ||||||||||||
| 238 | - | |||||||||||||
| 239 | if (!d->model) 
 | 0 | ||||||||||||
| 240 | return sourceSelection; never executed:  return sourceSelection; | 0 | ||||||||||||
| 241 | - | |||||||||||||
| 242 | QItemSelection::const_iterator it = selection.constBegin(); | - | ||||||||||||
| 243 | const QItemSelection::const_iterator end = selection.constEnd(); | - | ||||||||||||
| 244 | sourceSelection.reserve(selection.count()); | - | ||||||||||||
| 245 | for ( ; it != end; ++it) { 
 | 0 | ||||||||||||
| 246 | Q_ASSERT(it->model() == this); | - | ||||||||||||
| 247 | const QItemSelectionRange range(mapToSource(it->topLeft()), mapToSource(it->bottomRight())); | - | ||||||||||||
| 248 | sourceSelection.append(range); | - | ||||||||||||
| 249 | } never executed:  end of block | 0 | ||||||||||||
| 250 | - | |||||||||||||
| 251 | return sourceSelection; never executed:  return sourceSelection; | 0 | ||||||||||||
| 252 | } | - | ||||||||||||
| 253 | - | |||||||||||||
| 254 | /*! | - | ||||||||||||
| 255 | \reimp | - | ||||||||||||
| 256 | */ | - | ||||||||||||
| 257 | QModelIndex QIdentityProxyModel::mapToSource(const QModelIndex& proxyIndex) const | - | ||||||||||||
| 258 | { | - | ||||||||||||
| 259 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 260 | if (!d->model || !proxyIndex.isValid()) 
 
 | 0-678 | ||||||||||||
| 261 | return QModelIndex(); executed 36 times by 1 test:  return QModelIndex();Executed by: 
 | 36 | ||||||||||||
| 262 | Q_ASSERT(proxyIndex.model() == this); | - | ||||||||||||
| 263 | return d->model->createIndex(proxyIndex.row(), proxyIndex.column(), proxyIndex.internalPointer()); executed 642 times by 1 test:  return d->model->createIndex(proxyIndex.row(), proxyIndex.column(), proxyIndex.internalPointer());Executed by: 
 | 642 | ||||||||||||
| 264 | } | - | ||||||||||||
| 265 | - | |||||||||||||
| 266 | /*! | - | ||||||||||||
| 267 | \reimp | - | ||||||||||||
| 268 | */ | - | ||||||||||||
| 269 | QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const | - | ||||||||||||
| 270 | { | - | ||||||||||||
| 271 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 272 | Q_ASSERT(start.isValid() ? start.model() == this : true); | - | ||||||||||||
| 273 | if (!d->model) 
 | 0 | ||||||||||||
| 274 | return QModelIndexList(); never executed:  return QModelIndexList(); | 0 | ||||||||||||
| 275 | - | |||||||||||||
| 276 | const QModelIndexList sourceList = d->model->match(mapToSource(start), role, value, hits, flags); | - | ||||||||||||
| 277 | QModelIndexList::const_iterator it = sourceList.constBegin(); | - | ||||||||||||
| 278 | const QModelIndexList::const_iterator end = sourceList.constEnd(); | - | ||||||||||||
| 279 | QModelIndexList proxyList; | - | ||||||||||||
| 280 | proxyList.reserve(sourceList.count()); | - | ||||||||||||
| 281 | for ( ; it != end; ++it) 
 | 0 | ||||||||||||
| 282 | proxyList.append(mapFromSource(*it)); never executed:  proxyList.append(mapFromSource(*it)); | 0 | ||||||||||||
| 283 | return proxyList; never executed:  return proxyList; | 0 | ||||||||||||
| 284 | } | - | ||||||||||||
| 285 | - | |||||||||||||
| 286 | /*! | - | ||||||||||||
| 287 | \reimp | - | ||||||||||||
| 288 | */ | - | ||||||||||||
| 289 | QModelIndex QIdentityProxyModel::parent(const QModelIndex& child) const | - | ||||||||||||
| 290 | { | - | ||||||||||||
| 291 | Q_ASSERT(child.isValid() ? child.model() == this : true); | - | ||||||||||||
| 292 | const QModelIndex sourceIndex = mapToSource(child); | - | ||||||||||||
| 293 | const QModelIndex sourceParent = sourceIndex.parent(); | - | ||||||||||||
| 294 | return mapFromSource(sourceParent); executed 98 times by 1 test:  return mapFromSource(sourceParent);Executed by: 
 | 98 | ||||||||||||
| 295 | } | - | ||||||||||||
| 296 | - | |||||||||||||
| 297 | /*! | - | ||||||||||||
| 298 | \reimp | - | ||||||||||||
| 299 | */ | - | ||||||||||||
| 300 | bool QIdentityProxyModel::removeColumns(int column, int count, const QModelIndex& parent) | - | ||||||||||||
| 301 | { | - | ||||||||||||
| 302 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 303 | Q_D(QIdentityProxyModel); | - | ||||||||||||
| 304 | return d->model->removeColumns(column, count, mapToSource(parent)); never executed:  return d->model->removeColumns(column, count, mapToSource(parent)); | 0 | ||||||||||||
| 305 | } | - | ||||||||||||
| 306 | - | |||||||||||||
| 307 | /*! | - | ||||||||||||
| 308 | \reimp | - | ||||||||||||
| 309 | */ | - | ||||||||||||
| 310 | bool QIdentityProxyModel::removeRows(int row, int count, const QModelIndex& parent) | - | ||||||||||||
| 311 | { | - | ||||||||||||
| 312 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 313 | Q_D(QIdentityProxyModel); | - | ||||||||||||
| 314 | return d->model->removeRows(row, count, mapToSource(parent)); never executed:  return d->model->removeRows(row, count, mapToSource(parent)); | 0 | ||||||||||||
| 315 | } | - | ||||||||||||
| 316 | - | |||||||||||||
| 317 | /*! | - | ||||||||||||
| 318 | \reimp | - | ||||||||||||
| 319 | */ | - | ||||||||||||
| 320 | int QIdentityProxyModel::rowCount(const QModelIndex& parent) const | - | ||||||||||||
| 321 | { | - | ||||||||||||
| 322 | Q_ASSERT(parent.isValid() ? parent.model() == this : true); | - | ||||||||||||
| 323 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 324 | return d->model->rowCount(mapToSource(parent)); executed 127 times by 1 test:  return d->model->rowCount(mapToSource(parent));Executed by: 
 | 127 | ||||||||||||
| 325 | } | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | /*! | - | ||||||||||||
| 328 | \reimp | - | ||||||||||||
| 329 | */ | - | ||||||||||||
| 330 | QVariant QIdentityProxyModel::headerData(int section, Qt::Orientation orientation, int role) const | - | ||||||||||||
| 331 | { | - | ||||||||||||
| 332 | Q_D(const QIdentityProxyModel); | - | ||||||||||||
| 333 | return d->model->headerData(section, orientation, role); never executed:  return d->model->headerData(section, orientation, role); | 0 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | /*! | - | ||||||||||||
| 337 | \reimp | - | ||||||||||||
| 338 | */ | - | ||||||||||||
| 339 | void QIdentityProxyModel::setSourceModel(QAbstractItemModel* newSourceModel) | - | ||||||||||||
| 340 | { | - | ||||||||||||
| 341 | beginResetModel(); | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | if (sourceModel()) { 
 | 4-5 | ||||||||||||
| 344 | disconnect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), | - | ||||||||||||
| 345 | this, SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int))); | - | ||||||||||||
| 346 | disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), | - | ||||||||||||
| 347 | this, SLOT(_q_sourceRowsInserted(QModelIndex,int,int))); | - | ||||||||||||
| 348 | disconnect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 349 | this, SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 350 | disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 351 | this, SLOT(_q_sourceRowsRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 352 | disconnect(sourceModel(), SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 353 | this, SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 354 | disconnect(sourceModel(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 355 | this, SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 356 | disconnect(sourceModel(), SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), | - | ||||||||||||
| 357 | this, SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int))); | - | ||||||||||||
| 358 | disconnect(sourceModel(), SIGNAL(columnsInserted(QModelIndex,int,int)), | - | ||||||||||||
| 359 | this, SLOT(_q_sourceColumnsInserted(QModelIndex,int,int))); | - | ||||||||||||
| 360 | disconnect(sourceModel(), SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 361 | this, SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 362 | disconnect(sourceModel(), SIGNAL(columnsRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 363 | this, SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 364 | disconnect(sourceModel(), SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 365 | this, SLOT(_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 366 | disconnect(sourceModel(), SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 367 | this, SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 368 | disconnect(sourceModel(), SIGNAL(modelAboutToBeReset()), | - | ||||||||||||
| 369 | this, SLOT(_q_sourceModelAboutToBeReset())); | - | ||||||||||||
| 370 | disconnect(sourceModel(), SIGNAL(modelReset()), | - | ||||||||||||
| 371 | this, SLOT(_q_sourceModelReset())); | - | ||||||||||||
| 372 | disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), | - | ||||||||||||
| 373 | this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))); | - | ||||||||||||
| 374 | disconnect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), | - | ||||||||||||
| 375 | this, SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); | - | ||||||||||||
| 376 | disconnect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), | - | ||||||||||||
| 377 | this, SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); | - | ||||||||||||
| 378 | disconnect(sourceModel(), SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), | - | ||||||||||||
| 379 | this, SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); | - | ||||||||||||
| 380 | } executed 5 times by 1 test:  end of blockExecuted by: 
 | 5 | ||||||||||||
| 381 | - | |||||||||||||
| 382 | QAbstractProxyModel::setSourceModel(newSourceModel); | - | ||||||||||||
| 383 | - | |||||||||||||
| 384 | if (sourceModel()) { 
 | 3-6 | ||||||||||||
| 385 | connect(sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), | - | ||||||||||||
| 386 | SLOT(_q_sourceRowsAboutToBeInserted(QModelIndex,int,int))); | - | ||||||||||||
| 387 | connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), | - | ||||||||||||
| 388 | SLOT(_q_sourceRowsInserted(QModelIndex,int,int))); | - | ||||||||||||
| 389 | connect(sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 390 | SLOT(_q_sourceRowsAboutToBeRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 391 | connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 392 | SLOT(_q_sourceRowsRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 393 | connect(sourceModel(), SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 394 | SLOT(_q_sourceRowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 395 | connect(sourceModel(), SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 396 | SLOT(_q_sourceRowsMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 397 | connect(sourceModel(), SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)), | - | ||||||||||||
| 398 | SLOT(_q_sourceColumnsAboutToBeInserted(QModelIndex,int,int))); | - | ||||||||||||
| 399 | connect(sourceModel(), SIGNAL(columnsInserted(QModelIndex,int,int)), | - | ||||||||||||
| 400 | SLOT(_q_sourceColumnsInserted(QModelIndex,int,int))); | - | ||||||||||||
| 401 | connect(sourceModel(), SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 402 | SLOT(_q_sourceColumnsAboutToBeRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 403 | connect(sourceModel(), SIGNAL(columnsRemoved(QModelIndex,int,int)), | - | ||||||||||||
| 404 | SLOT(_q_sourceColumnsRemoved(QModelIndex,int,int))); | - | ||||||||||||
| 405 | connect(sourceModel(), SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 406 | SLOT(_q_sourceColumnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 407 | connect(sourceModel(), SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)), | - | ||||||||||||
| 408 | SLOT(_q_sourceColumnsMoved(QModelIndex,int,int,QModelIndex,int))); | - | ||||||||||||
| 409 | connect(sourceModel(), SIGNAL(modelAboutToBeReset()), | - | ||||||||||||
| 410 | SLOT(_q_sourceModelAboutToBeReset())); | - | ||||||||||||
| 411 | connect(sourceModel(), SIGNAL(modelReset()), | - | ||||||||||||
| 412 | SLOT(_q_sourceModelReset())); | - | ||||||||||||
| 413 | connect(sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)), | - | ||||||||||||
| 414 | SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex,QVector<int>))); | - | ||||||||||||
| 415 | connect(sourceModel(), SIGNAL(headerDataChanged(Qt::Orientation,int,int)), | - | ||||||||||||
| 416 | SLOT(_q_sourceHeaderDataChanged(Qt::Orientation,int,int))); | - | ||||||||||||
| 417 | connect(sourceModel(), SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), | - | ||||||||||||
| 418 | SLOT(_q_sourceLayoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); | - | ||||||||||||
| 419 | connect(sourceModel(), SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)), | - | ||||||||||||
| 420 | SLOT(_q_sourceLayoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint))); | - | ||||||||||||
| 421 | } executed 6 times by 1 test:  end of blockExecuted by: 
 | 6 | ||||||||||||
| 422 | - | |||||||||||||
| 423 | endResetModel(); | - | ||||||||||||
| 424 | } executed 9 times by 1 test:  end of blockExecuted by: 
 | 9 | ||||||||||||
| 425 | - | |||||||||||||
| 426 | void QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 427 | { | - | ||||||||||||
| 428 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 429 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 430 | q->beginInsertColumns(q->mapFromSource(parent), start, end); | - | ||||||||||||
| 431 | } executed 6 times by 1 test:  end of blockExecuted by: 
 | 6 | ||||||||||||
| 432 | - | |||||||||||||
| 433 | void QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest) | - | ||||||||||||
| 434 | { | - | ||||||||||||
| 435 | Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true); | - | ||||||||||||
| 436 | Q_ASSERT(destParent.isValid() ? destParent.model() == model : true); | - | ||||||||||||
| 437 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 438 | q->beginMoveColumns(q->mapFromSource(sourceParent), sourceStart, sourceEnd, q->mapFromSource(destParent), dest); | - | ||||||||||||
| 439 | } never executed:  end of block | 0 | ||||||||||||
| 440 | - | |||||||||||||
| 441 | void QIdentityProxyModelPrivate::_q_sourceColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 442 | { | - | ||||||||||||
| 443 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 444 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 445 | q->beginRemoveColumns(q->mapFromSource(parent), start, end); | - | ||||||||||||
| 446 | } never executed:  end of block | 0 | ||||||||||||
| 447 | - | |||||||||||||
| 448 | void QIdentityProxyModelPrivate::_q_sourceColumnsInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 449 | { | - | ||||||||||||
| 450 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 451 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 452 | Q_UNUSED(parent) | - | ||||||||||||
| 453 | Q_UNUSED(start) | - | ||||||||||||
| 454 | Q_UNUSED(end) | - | ||||||||||||
| 455 | q->endInsertColumns(); | - | ||||||||||||
| 456 | } executed 6 times by 1 test:  end of blockExecuted by: 
 | 6 | ||||||||||||
| 457 | - | |||||||||||||
| 458 | void QIdentityProxyModelPrivate::_q_sourceColumnsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest) | - | ||||||||||||
| 459 | { | - | ||||||||||||
| 460 | Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true); | - | ||||||||||||
| 461 | Q_ASSERT(destParent.isValid() ? destParent.model() == model : true); | - | ||||||||||||
| 462 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 463 | Q_UNUSED(sourceParent) | - | ||||||||||||
| 464 | Q_UNUSED(sourceStart) | - | ||||||||||||
| 465 | Q_UNUSED(sourceEnd) | - | ||||||||||||
| 466 | Q_UNUSED(destParent) | - | ||||||||||||
| 467 | Q_UNUSED(dest) | - | ||||||||||||
| 468 | q->endMoveColumns(); | - | ||||||||||||
| 469 | } never executed:  end of block | 0 | ||||||||||||
| 470 | - | |||||||||||||
| 471 | void QIdentityProxyModelPrivate::_q_sourceColumnsRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 472 | { | - | ||||||||||||
| 473 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 474 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 475 | Q_UNUSED(parent) | - | ||||||||||||
| 476 | Q_UNUSED(start) | - | ||||||||||||
| 477 | Q_UNUSED(end) | - | ||||||||||||
| 478 | q->endRemoveColumns(); | - | ||||||||||||
| 479 | } never executed:  end of block | 0 | ||||||||||||
| 480 | - | |||||||||||||
| 481 | void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) | - | ||||||||||||
| 482 | { | - | ||||||||||||
| 483 | Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true); | - | ||||||||||||
| 484 | Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true); | - | ||||||||||||
| 485 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 486 | q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles); | - | ||||||||||||
| 487 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 488 | - | |||||||||||||
| 489 | void QIdentityProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last) | - | ||||||||||||
| 490 | { | - | ||||||||||||
| 491 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 492 | q->headerDataChanged(orientation, first, last); | - | ||||||||||||
| 493 | } never executed:  end of block | 0 | ||||||||||||
| 494 | - | |||||||||||||
| 495 | void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint) | - | ||||||||||||
| 496 | { | - | ||||||||||||
| 497 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 498 | - | |||||||||||||
| 499 | const auto proxyPersistentIndexes = q->persistentIndexList(); | - | ||||||||||||
| 500 | for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) { | - | ||||||||||||
| 501 | proxyIndexes << proxyPersistentIndex; | - | ||||||||||||
| 502 | Q_ASSERT(proxyPersistentIndex.isValid()); | - | ||||||||||||
| 503 | const QPersistentModelIndex srcPersistentIndex = q->mapToSource(proxyPersistentIndex); | - | ||||||||||||
| 504 | Q_ASSERT(srcPersistentIndex.isValid()); | - | ||||||||||||
| 505 | layoutChangePersistentIndexes << srcPersistentIndex; | - | ||||||||||||
| 506 | } never executed:  end of block | 0 | ||||||||||||
| 507 | - | |||||||||||||
| 508 | QList<QPersistentModelIndex> parents; | - | ||||||||||||
| 509 | parents.reserve(sourceParents.size()); | - | ||||||||||||
| 510 | for (const QPersistentModelIndex &parent : sourceParents) { | - | ||||||||||||
| 511 | if (!parent.isValid()) { 
 | 0 | ||||||||||||
| 512 | parents << QPersistentModelIndex(); | - | ||||||||||||
| 513 | continue; never executed:  continue; | 0 | ||||||||||||
| 514 | } | - | ||||||||||||
| 515 | const QModelIndex mappedParent = q->mapFromSource(parent); | - | ||||||||||||
| 516 | Q_ASSERT(mappedParent.isValid()); | - | ||||||||||||
| 517 | parents << mappedParent; | - | ||||||||||||
| 518 | } never executed:  end of block | 0 | ||||||||||||
| 519 | - | |||||||||||||
| 520 | q->layoutAboutToBeChanged(parents, hint); | - | ||||||||||||
| 521 | } never executed:  end of block | 0 | ||||||||||||
| 522 | - | |||||||||||||
| 523 | void QIdentityProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint) | - | ||||||||||||
| 524 | { | - | ||||||||||||
| 525 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 526 | - | |||||||||||||
| 527 | for (int i = 0; i < proxyIndexes.size(); ++i) { 
 | 0 | ||||||||||||
| 528 | q->changePersistentIndex(proxyIndexes.at(i), q->mapFromSource(layoutChangePersistentIndexes.at(i))); | - | ||||||||||||
| 529 | } never executed:  end of block | 0 | ||||||||||||
| 530 | - | |||||||||||||
| 531 | layoutChangePersistentIndexes.clear(); | - | ||||||||||||
| 532 | proxyIndexes.clear(); | - | ||||||||||||
| 533 | - | |||||||||||||
| 534 | QList<QPersistentModelIndex> parents; | - | ||||||||||||
| 535 | parents.reserve(sourceParents.size()); | - | ||||||||||||
| 536 | for (const QPersistentModelIndex &parent : sourceParents) { | - | ||||||||||||
| 537 | if (!parent.isValid()) { 
 | 0 | ||||||||||||
| 538 | parents << QPersistentModelIndex(); | - | ||||||||||||
| 539 | continue; never executed:  continue; | 0 | ||||||||||||
| 540 | } | - | ||||||||||||
| 541 | const QModelIndex mappedParent = q->mapFromSource(parent); | - | ||||||||||||
| 542 | Q_ASSERT(mappedParent.isValid()); | - | ||||||||||||
| 543 | parents << mappedParent; | - | ||||||||||||
| 544 | } never executed:  end of block | 0 | ||||||||||||
| 545 | - | |||||||||||||
| 546 | q->layoutChanged(parents, hint); | - | ||||||||||||
| 547 | } never executed:  end of block | 0 | ||||||||||||
| 548 | - | |||||||||||||
| 549 | void QIdentityProxyModelPrivate::_q_sourceModelAboutToBeReset() | - | ||||||||||||
| 550 | { | - | ||||||||||||
| 551 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 552 | q->beginResetModel(); | - | ||||||||||||
| 553 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||
| 554 | - | |||||||||||||
| 555 | void QIdentityProxyModelPrivate::_q_sourceModelReset() | - | ||||||||||||
| 556 | { | - | ||||||||||||
| 557 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 558 | q->endResetModel(); | - | ||||||||||||
| 559 | } executed 3 times by 1 test:  end of blockExecuted by: 
 | 3 | ||||||||||||
| 560 | - | |||||||||||||
| 561 | void QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 562 | { | - | ||||||||||||
| 563 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 564 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 565 | q->beginInsertRows(q->mapFromSource(parent), start, end); | - | ||||||||||||
| 566 | } executed 5 times by 1 test:  end of blockExecuted by: 
 | 5 | ||||||||||||
| 567 | - | |||||||||||||
| 568 | void QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest) | - | ||||||||||||
| 569 | { | - | ||||||||||||
| 570 | Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true); | - | ||||||||||||
| 571 | Q_ASSERT(destParent.isValid() ? destParent.model() == model : true); | - | ||||||||||||
| 572 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 573 | q->beginMoveRows(q->mapFromSource(sourceParent), sourceStart, sourceEnd, q->mapFromSource(destParent), dest); | - | ||||||||||||
| 574 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 575 | - | |||||||||||||
| 576 | void QIdentityProxyModelPrivate::_q_sourceRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 577 | { | - | ||||||||||||
| 578 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 579 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 580 | q->beginRemoveRows(q->mapFromSource(parent), start, end); | - | ||||||||||||
| 581 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 582 | - | |||||||||||||
| 583 | void QIdentityProxyModelPrivate::_q_sourceRowsInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 584 | { | - | ||||||||||||
| 585 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 586 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 587 | Q_UNUSED(parent) | - | ||||||||||||
| 588 | Q_UNUSED(start) | - | ||||||||||||
| 589 | Q_UNUSED(end) | - | ||||||||||||
| 590 | q->endInsertRows(); | - | ||||||||||||
| 591 | } executed 5 times by 1 test:  end of blockExecuted by: 
 | 5 | ||||||||||||
| 592 | - | |||||||||||||
| 593 | void QIdentityProxyModelPrivate::_q_sourceRowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destParent, int dest) | - | ||||||||||||
| 594 | { | - | ||||||||||||
| 595 | Q_ASSERT(sourceParent.isValid() ? sourceParent.model() == model : true); | - | ||||||||||||
| 596 | Q_ASSERT(destParent.isValid() ? destParent.model() == model : true); | - | ||||||||||||
| 597 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 598 | Q_UNUSED(sourceParent) | - | ||||||||||||
| 599 | Q_UNUSED(sourceStart) | - | ||||||||||||
| 600 | Q_UNUSED(sourceEnd) | - | ||||||||||||
| 601 | Q_UNUSED(destParent) | - | ||||||||||||
| 602 | Q_UNUSED(dest) | - | ||||||||||||
| 603 | q->endMoveRows(); | - | ||||||||||||
| 604 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 605 | - | |||||||||||||
| 606 | void QIdentityProxyModelPrivate::_q_sourceRowsRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||
| 607 | { | - | ||||||||||||
| 608 | Q_ASSERT(parent.isValid() ? parent.model() == model : true); | - | ||||||||||||
| 609 | Q_Q(QIdentityProxyModel); | - | ||||||||||||
| 610 | Q_UNUSED(parent) | - | ||||||||||||
| 611 | Q_UNUSED(start) | - | ||||||||||||
| 612 | Q_UNUSED(end) | - | ||||||||||||
| 613 | q->endRemoveRows(); | - | ||||||||||||
| 614 | } executed 1 time by 1 test:  end of blockExecuted by: 
 | 1 | ||||||||||||
| 615 | - | |||||||||||||
| 616 | QT_END_NAMESPACE | - | ||||||||||||
| 617 | - | |||||||||||||
| 618 | #include "moc_qidentityproxymodel.cpp" | - | ||||||||||||
| 619 | - | |||||||||||||
| 620 | #endif // QT_NO_IDENTITYPROXYMODEL | - | ||||||||||||
| Source code | Switch to Preprocessed file |