qitemselectionmodel.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
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 "qitemselectionmodel.h"-
41#include <private/qitemselectionmodel_p.h>-
42#include <qdebug.h>-
43-
44#include <algorithm>-
45-
46#ifndef QT_NO_ITEMVIEWS-
47-
48QT_BEGIN_NAMESPACE-
49-
50/*!-
51 \class QItemSelectionRange-
52 \inmodule QtCore-
53-
54 \brief The QItemSelectionRange class manages information about a-
55 range of selected items in a model.-
56-
57 \ingroup model-view-
58-
59 A QItemSelectionRange contains information about a range of-
60 selected items in a model. A range of items is a contiguous array-
61 of model items, extending to cover a number of adjacent rows and-
62 columns with a common parent item; this can be visualized as a-
63 two-dimensional block of cells in a table. A selection range has a-
64 top(), left() a bottom(), right() and a parent().-
65-
66 The QItemSelectionRange class is one of the \l{Model/View Classes}-
67 and is part of Qt's \l{Model/View Programming}{model/view framework}.-
68-
69 The model items contained in the selection range can be obtained-
70 using the indexes() function. Use QItemSelectionModel::selectedIndexes()-
71 to get a list of all selected items for a view.-
72-
73 You can determine whether a given model item lies within a-
74 particular range by using the contains() function. Ranges can also-
75 be compared using the overloaded operators for equality and-
76 inequality, and the intersects() function allows you to determine-
77 whether two ranges overlap.-
78-
79 \sa {Model/View Programming}, QAbstractItemModel, QItemSelection,-
80 QItemSelectionModel-
81*/-
82-
83/*!-
84 \fn QItemSelectionRange::QItemSelectionRange()-
85-
86 Constructs an empty selection range.-
87*/-
88-
89/*!-
90 \fn QItemSelectionRange::QItemSelectionRange(const QItemSelectionRange &other)-
91-
92 Copy constructor. Constructs a new selection range with the same contents-
93 as the \a other range given.-
94-
95*/-
96-
97/*!-
98 \fn QItemSelectionRange::QItemSelectionRange(const QModelIndex &topLeft, const QModelIndex &bottomRight)-
99-
100 Constructs a new selection range containing only the index specified-
101 by the \a topLeft and the index \a bottomRight.-
102-
103*/-
104-
105/*!-
106 \fn QItemSelectionRange::QItemSelectionRange(const QModelIndex &index)-
107-
108 Constructs a new selection range containing only the model item specified-
109 by the model index \a index.-
110*/-
111-
112/*!-
113 \fn QItemSelectionRange::swap(QItemSelectionRange &other)-
114 \since 5.6-
115-
116 Swaps this selection range's contents with \a other.-
117 This function is very fast and never fails.-
118*/-
119-
120/*!-
121 \fn int QItemSelectionRange::top() const-
122-
123 Returns the row index corresponding to the uppermost selected row in the-
124 selection range.-
125-
126*/-
127-
128/*!-
129 \fn int QItemSelectionRange::left() const-
130-
131 Returns the column index corresponding to the leftmost selected column in the-
132 selection range.-
133*/-
134-
135/*!-
136 \fn int QItemSelectionRange::bottom() const-
137-
138 Returns the row index corresponding to the lowermost selected row in the-
139 selection range.-
140-
141*/-
142-
143/*!-
144 \fn int QItemSelectionRange::right() const-
145-
146 Returns the column index corresponding to the rightmost selected column in-
147 the selection range.-
148-
149*/-
150-
151/*!-
152 \fn int QItemSelectionRange::width() const-
153-
154 Returns the number of selected columns in the selection range.-
155-
156*/-
157-
158/*!-
159 \fn int QItemSelectionRange::height() const-
160-
161 Returns the number of selected rows in the selection range.-
162-
163*/-
164-
165/*!-
166 \fn const QAbstractItemModel *QItemSelectionRange::model() const-
167-
168 Returns the model that the items in the selection range belong to.-
169*/-
170-
171/*!-
172 \fn QModelIndex QItemSelectionRange::topLeft() const-
173-
174 Returns the index for the item located at the top-left corner of-
175 the selection range.-
176-
177 \sa top(), left(), bottomRight()-
178*/-
179-
180/*!-
181 \fn QModelIndex QItemSelectionRange::bottomRight() const-
182-
183 Returns the index for the item located at the bottom-right corner-
184 of the selection range.-
185-
186 \sa bottom(), right(), topLeft()-
187*/-
188-
189/*!-
190 \fn QModelIndex QItemSelectionRange::parent() const-
191-
192 Returns the parent model item index of the items in the selection range.-
193-
194*/-
195-
196/*!-
197 \fn bool QItemSelectionRange::contains(const QModelIndex &index) const-
198-
199 Returns \c true if the model item specified by the \a index lies within the-
200 range of selected items; otherwise returns \c false.-
201*/-
202-
203/*!-
204 \fn bool QItemSelectionRange::contains(int row, int column,-
205 const QModelIndex &parentIndex) const-
206 \overload-
207-
208 Returns \c true if the model item specified by (\a row, \a column)-
209 and with \a parentIndex as the parent item lies within the range-
210 of selected items; otherwise returns \c false.-
211*/-
212-
213/*!-
214 \fn bool QItemSelectionRange::intersects(const QItemSelectionRange &other) const-
215-
216 Returns \c true if this selection range intersects (overlaps with) the \a other-
217 range given; otherwise returns \c false.-
218-
219*/-
220bool QItemSelectionRange::intersects(const QItemSelectionRange &other) const-
221{-
222 return (isValid() && other.isValid()
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
223 && parent() == other.parent()
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
224 && model() == other.model()
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
225 && ((top() <= other.top() && bottom() >= other.top())
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
226 || (top() >= other.top() && top() <= other.bottom()))
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
227 && ((left() <= other.left() && right() >= other.left())
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
228 || (left() >= other.left() && left() <= other.right())));
executed 9777 times by 21 tests: return (isValid() && other.isValid() && parent() == other.parent() && model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) || (left() >= other.left() && left() <= other.right())));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
9777
229}-
230-
231/*!-
232 \fn QItemSelectionRange QItemSelectionRange::intersect(const QItemSelectionRange &other) const-
233 \obsolete-
234-
235 Use intersected(\a other) instead.-
236*/-
237-
238/*!-
239 \fn QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &other) const-
240 \since 4.2-
241-
242 Returns a new selection range containing only the items that are found in-
243 both the selection range and the \a other selection range.-
244*/-
245-
246QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange &other) const-
247{-
248 if (model() == other.model() && parent() == other.parent()) {
model() == other.model()Description
TRUEevaluated 891 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
parent() == other.parent()Description
TRUEevaluated 891 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
0-891
249 QModelIndex topLeft = model()->index(qMax(top(), other.top()),-
250 qMax(left(), other.left()),-
251 other.parent());-
252 QModelIndex bottomRight = model()->index(qMin(bottom(), other.bottom()),-
253 qMin(right(), other.right()),-
254 other.parent());-
255 return QItemSelectionRange(topLeft, bottomRight);
executed 891 times by 11 tests: return QItemSelectionRange(topLeft, bottomRight);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
891
256 }-
257 return QItemSelectionRange();
never executed: return QItemSelectionRange();
0
258}-
259-
260/*!-
261 \fn bool QItemSelectionRange::operator==(const QItemSelectionRange &other) const-
262-
263 Returns \c true if the selection range is exactly the same as the \a other-
264 range given; otherwise returns \c false.-
265-
266*/-
267-
268/*!-
269 \fn bool QItemSelectionRange::operator!=(const QItemSelectionRange &other) const-
270-
271 Returns \c true if the selection range differs from the \a other range given;-
272 otherwise returns \c false.-
273-
274*/-
275-
276/*!-
277 \fn bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const-
278-
279 Returns \c true if the selection range is less than the \a other-
280 range given; otherwise returns \c false.-
281-
282 The less than calculation is not directly useful to developers - the way that ranges-
283 with different parents compare is not defined. This operator only exists so that the-
284 class can be used with QMap.-
285-
286*/-
287-
288/*!-
289 \fn bool QItemSelectionRange::isValid() const-
290-
291 Returns \c true if the selection range is valid; otherwise returns \c false.-
292-
293*/-
294-
295static void rowLengthsFromRange(const QItemSelectionRange &range, QVector<QPair<QPersistentModelIndex, uint> > &result)-
296{-
297 if (range.isValid() && range.model()) {
range.isValid()Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEnever evaluated
range.model()Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEnever evaluated
0-15
298 const QModelIndex topLeft = range.topLeft();-
299 const int bottom = range.bottom();-
300 const uint width = range.width();-
301 const int column = topLeft.column();-
302 for (int row = topLeft.row(); row <= bottom; ++row) {
row <= bottomDescription
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
15-23
303 // We don't need to keep track of ItemIsSelectable and ItemIsEnabled here. That is-
304 // required in indexesFromRange() because that method is called from public API-
305 // which requires the limitation.-
306 result.push_back(qMakePair(QPersistentModelIndex(topLeft.sibling(row, column)), width));-
307 }
executed 23 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
23
308 }
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
15
309}
executed 15 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
15
310-
311template<typename ModelIndexContainer>-
312static void indexesFromRange(const QItemSelectionRange &range, ModelIndexContainer &result)-
313{-
314 if (range.isValid() && range.model()) {
range.isValid()Description
TRUEevaluated 1046 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEnever evaluated
range.model()Description
TRUEevaluated 1046 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEnever evaluated
0-1046
315 const QModelIndex topLeft = range.topLeft();-
316 const int bottom = range.bottom();-
317 const int right = range.right();-
318 for (int row = topLeft.row(); row <= bottom; ++row) {
row <= bottomDescription
TRUEevaluated 2176 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 1046 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1046-2176
319 const QModelIndex columnLeader = topLeft.sibling(row, topLeft.column());-
320 for (int column = topLeft.column(); column <= right; ++column) {
column <= rightDescription
TRUEevaluated 5925 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 2176 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2176-5925
321 QModelIndex index = columnLeader.sibling(row, column);-
322 Qt::ItemFlags flags = range.model()->flags(index);-
323 if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))-
324 result.push_back(index);
executed 5912 times by 18 tests: result.push_back(index);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
5912
325 }
executed 5925 times by 18 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
5925
326 }
executed 2176 times by 18 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2176
327 }
executed 1046 times by 18 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1046
328}
executed 1046 times by 18 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1046
329-
330template<typename ModelIndexContainer>-
331static ModelIndexContainer qSelectionIndexes(const QItemSelection &selection)-
332{-
333 ModelIndexContainer result;-
334 for (const auto &range : selection)-
335 indexesFromRange(range, result);
executed 1046 times by 18 tests: indexesFromRange(range, result);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1046
336 return result;
executed 6813 times by 24 tests: return result;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
6813
337}-
338-
339/*!-
340 Returns \c true if the selection range contains no selectable item-
341 \since 4.7-
342*/-
343-
344bool QItemSelectionRange::isEmpty() const-
345{-
346 if (!isValid() || !model())
!isValid()Description
TRUEnever evaluated
FALSEevaluated 431 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
!model()Description
TRUEnever evaluated
FALSEevaluated 431 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
0-431
347 return true;
never executed: return true;
0
348-
349 for (int column = left(); column <= right(); ++column) {
column <= right()Description
TRUEevaluated 431 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-431
350 for (int row = top(); row <= bottom(); ++row) {
row <= bottom()Description
TRUEevaluated 431 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-431
351 QModelIndex index = model()->index(row, column, parent());-
352 Qt::ItemFlags flags = model()->flags(index);-
353 if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))-
354 return false;
executed 431 times by 3 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
431
355 }
never executed: end of block
0
356 }
never executed: end of block
0
357 return true;
never executed: return true;
0
358}-
359-
360/*!-
361 Returns the list of model index items stored in the selection.-
362*/-
363-
364QModelIndexList QItemSelectionRange::indexes() const-
365{-
366 QModelIndexList result;-
367 indexesFromRange(*this, result);-
368 return result;
never executed: return result;
0
369}-
370-
371/*!-
372 \class QItemSelection-
373 \inmodule QtCore-
374-
375 \brief The QItemSelection class manages information about selected items in a model.-
376-
377 \ingroup model-view-
378-
379 A QItemSelection describes the items in a model that have been-
380 selected by the user. A QItemSelection is basically a list of-
381 selection ranges, see QItemSelectionRange. It provides functions for-
382 creating and manipulating selections, and selecting a range of items-
383 from a model.-
384-
385 The QItemSelection class is one of the \l{Model/View Classes}-
386 and is part of Qt's \l{Model/View Programming}{model/view framework}.-
387-
388 An item selection can be constructed and initialized to contain a-
389 range of items from an existing model. The following example constructs-
390 a selection that contains a range of items from the given \c model,-
391 beginning at the \c topLeft, and ending at the \c bottomRight.-
392-
393 \snippet code/src_gui_itemviews_qitemselectionmodel.cpp 0-
394-
395 An empty item selection can be constructed, and later populated as-
396 required. So, if the model is going to be unavailable when we construct-
397 the item selection, we can rewrite the above code in the following way:-
398-
399 \snippet code/src_gui_itemviews_qitemselectionmodel.cpp 1-
400-
401 QItemSelection saves memory, and avoids unnecessary work, by working with-
402 selection ranges rather than recording the model item index for each-
403 item in the selection. Generally, an instance of this class will contain-
404 a list of non-overlapping selection ranges.-
405-
406 Use merge() to merge one item selection into another without making-
407 overlapping ranges. Use split() to split one selection range into-
408 smaller ranges based on a another selection range.-
409-
410 \sa {Model/View Programming}, QItemSelectionModel-
411*/-
412-
413/*!-
414 \fn QItemSelection::QItemSelection()-
415-
416 Constructs an empty selection.-
417*/-
418-
419/*!-
420 Constructs an item selection that extends from the top-left model item,-
421 specified by the \a topLeft index, to the bottom-right item, specified-
422 by \a bottomRight.-
423*/-
424QItemSelection::QItemSelection(const QModelIndex &topLeft, const QModelIndex &bottomRight)-
425{-
426 select(topLeft, bottomRight);-
427}
executed 4828 times by 30 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • ...
4828
428-
429/*!-
430 Adds the items in the range that extends from the top-left model-
431 item, specified by the \a topLeft index, to the bottom-right item,-
432 specified by \a bottomRight to the list.-
433-
434 \note \a topLeft and \a bottomRight must have the same parent.-
435*/-
436void QItemSelection::select(const QModelIndex &topLeft, const QModelIndex &bottomRight)-
437{-
438 if (!topLeft.isValid() || !bottomRight.isValid())
!topLeft.isValid()Description
TRUEevaluated 256 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 5313 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
!bottomRight.isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 5312 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
1-5313
439 return;
executed 257 times by 18 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
257
440-
441 if ((topLeft.model() != bottomRight.model())
(topLeft.model...Right.model())Description
TRUEnever evaluated
FALSEevaluated 5312 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
0-5312
442 || topLeft.parent() != bottomRight.parent()) {
topLeft.parent...Right.parent()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 5311 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
1-5311
443 qWarning("Can't select indexes from different model or with different parents");-
444 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QItemSelectionModel
1
445 }-
446 if (topLeft.row() > bottomRight.row() || topLeft.column() > bottomRight.column()) {
topLeft.row() ...tomRight.row()Description
TRUEnever evaluated
FALSEevaluated 5311 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
topLeft.column...Right.column()Description
TRUEnever evaluated
FALSEevaluated 5311 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
0-5311
447 int top = qMin(topLeft.row(), bottomRight.row());-
448 int bottom = qMax(topLeft.row(), bottomRight.row());-
449 int left = qMin(topLeft.column(), bottomRight.column());-
450 int right = qMax(topLeft.column(), bottomRight.column());-
451 QModelIndex tl = topLeft.sibling(top, left);-
452 QModelIndex br = bottomRight.sibling(bottom, right);-
453 append(QItemSelectionRange(tl, br));-
454 return;
never executed: return;
0
455 }-
456 append(QItemSelectionRange(topLeft, bottomRight));-
457}
executed 5311 times by 29 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
5311
458-
459/*!-
460 Returns \c true if the selection contains the given \a index; otherwise-
461 returns \c false.-
462*/-
463-
464bool QItemSelection::contains(const QModelIndex &index) const-
465{-
466 if (index.flags() & Qt::ItemIsSelectable) {
index.flags() ...emIsSelectableDescription
TRUEevaluated 9021 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QCalendarWidget
7-9021
467 QList<QItemSelectionRange>::const_iterator it = begin();-
468 for (; it != end(); ++it)
it != end()Description
TRUEevaluated 11213 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 7396 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
7396-11213
469 if ((*it).contains(index))
(*it).contains(index)Description
TRUEevaluated 1625 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 9588 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1625-9588
470 return true;
executed 1625 times by 21 tests: return true;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
1625
471 }
executed 7396 times by 19 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
7396
472 return false;
executed 7403 times by 19 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
7403
473}-
474-
475/*!-
476 Returns a list of model indexes that correspond to the selected items.-
477*/-
478-
479QModelIndexList QItemSelection::indexes() const-
480{-
481 return qSelectionIndexes<QModelIndexList>(*this);
executed 1153 times by 17 tests: return qSelectionIndexes<QModelIndexList>(*this);
Executed by:
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1153
482}-
483-
484static QVector<QPair<QPersistentModelIndex, uint> > qSelectionPersistentRowLengths(const QItemSelection &sel)-
485{-
486 QVector<QPair<QPersistentModelIndex, uint> > result;-
487 for (const QItemSelectionRange &range : sel)-
488 rowLengthsFromRange(range, result);
executed 15 times by 2 tests: rowLengthsFromRange(range, result);
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
15
489 return result;
executed 250 times by 9 tests: return result;
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
250
490}-
491-
492/*!-
493 Merges the \a other selection with this QItemSelection using the-
494 \a command given. This method guarantees that no ranges are overlapping.-
495-
496 Note that only QItemSelectionModel::Select,-
497 QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are-
498 supported.-
499-
500 \sa split()-
501*/-
502void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)-
503{-
504 if (other.isEmpty() ||
other.isEmpty()Description
TRUEevaluated 229960 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 13405 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
13405-229960
505 !(command & QItemSelectionModel::Select ||-
506 command & QItemSelectionModel::Deselect ||-
507 command & QItemSelectionModel::Toggle))-
508 return;
executed 229960 times by 42 tests: return;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
229960
509-
510 QItemSelection newSelection = other;-
511 // Collect intersections-
512 QItemSelection intersections;-
513 QItemSelection::iterator it = newSelection.begin();-
514 while (it != newSelection.end()) {
it != newSelection.end()Description
TRUEevaluated 13942 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
FALSEevaluated 13405 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
13405-13942
515 if (!(*it).isValid()) {
!(*it).isValid()Description
TRUEevaluated 234 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 13708 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
234-13708
516 it = newSelection.erase(it);-
517 continue;
executed 234 times by 15 tests: continue;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
234
518 }-
519 for (int t = 0; t < count(); ++t) {
t < count()Description
TRUEevaluated 3578 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 13708 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
3578-13708
520 if ((*it).intersects(at(t)))
(*it).intersects(at(t))Description
TRUEevaluated 639 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2939 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
639-2939
521 intersections.append(at(t).intersected(*it));
executed 639 times by 10 tests: intersections.append(at(t).intersected(*it));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
639
522 }
executed 3578 times by 15 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
3578
523 ++it;-
524 }
executed 13708 times by 29 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
13708
525-
526 // Split the old (and new) ranges using the intersections-
527 for (int i = 0; i < intersections.count(); ++i) { // for each intersection
i < intersections.count()Description
TRUEevaluated 639 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 13405 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
639-13405
528 for (int t = 0; t < count();) { // splitt each old range
t < count()Description
TRUEevaluated 2131 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 639 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
639-2131
529 if (at(t).intersects(intersections.at(i))) {
at(t).intersec...ections.at(i))Description
TRUEevaluated 639 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1492 times by 9 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
639-1492
530 split(at(t), intersections.at(i), this);-
531 removeAt(t);-
532 } else {
executed 639 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
639
533 ++t;-
534 }
executed 1492 times by 9 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1492
535 }-
536 // only split newSelection if Toggle is specified-
537 for (int n = 0; (command & QItemSelectionModel::Toggle) && n < newSelection.count();) {
n < newSelection.count()Description
TRUEevaluated 92 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
81-92
538 if (newSelection.at(n).intersects(intersections.at(i))) {
newSelection.a...ections.at(i))Description
TRUEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
11-81
539 split(newSelection.at(n), intersections.at(i), &newSelection);-
540 newSelection.removeAt(n);-
541 } else {
executed 81 times by 3 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
81
542 ++n;-
543 }
executed 11 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
11
544 }-
545 }
executed 639 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
639
546 // do not add newSelection for Deselect-
547 if (!(command & QItemSelectionModel::Deselect))
!(command & QI...del::Deselect)Description
TRUEevaluated 12562 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
FALSEevaluated 843 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
843-12562
548 operator+=(newSelection);
executed 12562 times by 27 tests: operator+=(newSelection);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
12562
549}
executed 13405 times by 29 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
13405
550-
551/*!-
552 Splits the selection \a range using the selection \a other range.-
553 Removes all items in \a other from \a range and puts the result in \a result.-
554 This can be compared with the semantics of the \e subtract operation of a set.-
555 \sa merge()-
556*/-
557-
558void QItemSelection::split(const QItemSelectionRange &range,-
559 const QItemSelectionRange &other, QItemSelection *result)-
560{-
561 if (range.parent() != other.parent() || range.model() != other.model())
range.parent()...other.parent()Description
TRUEnever evaluated
FALSEevaluated 1238 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
range.model() != other.model()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 1237 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
0-1238
562 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QItemSelectionModel
1
563-
564 QModelIndex parent = other.parent();-
565 int top = range.top();-
566 int left = range.left();-
567 int bottom = range.bottom();-
568 int right = range.right();-
569 int other_top = other.top();-
570 int other_left = other.left();-
571 int other_bottom = other.bottom();-
572 int other_right = other.right();-
573 const QAbstractItemModel *model = range.model();-
574 Q_ASSERT(model);-
575 if (other_top > top) {
other_top > topDescription
TRUEevaluated 214 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
FALSEevaluated 1023 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
214-1023
576 QModelIndex tl = model->index(top, left, parent);-
577 QModelIndex br = model->index(other_top - 1, right, parent);-
578 result->append(QItemSelectionRange(tl, br));-
579 top = other_top;-
580 }
executed 214 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
214
581 if (other_bottom < bottom) {
other_bottom < bottomDescription
TRUEevaluated 162 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 1075 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
162-1075
582 QModelIndex tl = model->index(other_bottom + 1, left, parent);-
583 QModelIndex br = model->index(bottom, right, parent);-
584 result->append(QItemSelectionRange(tl, br));-
585 bottom = other_bottom;-
586 }
executed 162 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
162
587 if (other_left > left) {
other_left > leftDescription
TRUEevaluated 175 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 1062 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
175-1062
588 QModelIndex tl = model->index(top, left, parent);-
589 QModelIndex br = model->index(bottom, other_left - 1, parent);-
590 result->append(QItemSelectionRange(tl, br));-
591 left = other_left;-
592 }
executed 175 times by 5 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
175
593 if (other_right < right) {
other_right < rightDescription
TRUEevaluated 150 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 1087 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
150-1087
594 QModelIndex tl = model->index(top, other_right + 1, parent);-
595 QModelIndex br = model->index(bottom, right, parent);-
596 result->append(QItemSelectionRange(tl, br));-
597 right = other_right;-
598 }
executed 150 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
150
599}
executed 1237 times by 11 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1237
600-
601-
602void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m)-
603{-
604 struct Cx {-
605 const char *signal;-
606 const char *slot;-
607 };-
608 static const Cx connections[] = {-
609 { SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),-
610 SLOT(_q_rowsAboutToBeRemoved(QModelIndex,int,int)) },-
611 { SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),-
612 SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)) },-
613 { SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),-
614 SLOT(_q_rowsAboutToBeInserted(QModelIndex,int,int)) },-
615 { SIGNAL(columnsAboutToBeInserted(QModelIndex,int,int)),-
616 SLOT(_q_columnsAboutToBeInserted(QModelIndex,int,int)) },-
617 { SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),-
618 SLOT(_q_layoutAboutToBeChanged()) },-
619 { SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),-
620 SLOT(_q_layoutAboutToBeChanged()) },-
621 { SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),-
622 SLOT(_q_layoutChanged()) },-
623 { SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),-
624 SLOT(_q_layoutChanged()) },-
625 { SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),-
626 SLOT(_q_layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)) },-
627 { SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),-
628 SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)) },-
629 { SIGNAL(modelReset()),-
630 SLOT(reset()) },-
631 { 0, 0 }-
632 };-
633-
634 if (model == m)
model == mDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 5009 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
1-5009
635 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QItemSelectionModel
1
636-
637 Q_Q(QItemSelectionModel);-
638 if (model) {
modelDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 5008 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
1-5008
639 for (const Cx *cx = &connections[0]; cx->signal; cx++)
cx->signalDescription
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
1-11
640 QObject::disconnect(model, cx->signal, q, cx->slot);
executed 11 times by 1 test: QObject::disconnect(model, cx->signal, q, cx->slot);
Executed by:
  • tst_QItemSelectionModel
11
641 q->reset();-
642 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
1
643 model = m;-
644 if (model) {
modelDescription
TRUEevaluated 5008 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
1-5008
645 for (const Cx *cx = &connections[0]; cx->signal; cx++)
cx->signalDescription
TRUEevaluated 55088 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 5008 times by 42 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
5008-55088
646 QObject::connect(model, cx->signal, q, cx->slot);
executed 55088 times by 42 tests: QObject::connect(model, cx->signal, q, cx->slot);
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
55088
647 }
executed 5008 times by 42 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
5008
648}
executed 5009 times by 42 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
5009
649-
650/*!-
651 \internal-
652-
653 returns a QItemSelection where all ranges have been expanded to:-
654 Rows: left: 0 and right: columnCount()-1-
655 Columns: top: 0 and bottom: rowCount()-1-
656*/-
657-
658QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection &selection,-
659 QItemSelectionModel::SelectionFlags command) const-
660{-
661 if (selection.isEmpty() && !((command & QItemSelectionModel::Rows) ||
selection.isEmpty()Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 544 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
11-544
662 (command & QItemSelectionModel::Columns)))
(command & QIt...odel::Columns)Description
TRUEnever evaluated
FALSEnever evaluated
0
663 return selection;
never executed: return selection;
0
664-
665 QItemSelection expanded;-
666 if (command & QItemSelectionModel::Rows) {
command & QIte...ionModel::RowsDescription
TRUEevaluated 519 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
36-519
667 for (int i = 0; i < selection.count(); ++i) {
i < selection.count()Description
TRUEevaluated 513 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 519 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
513-519
668 QModelIndex parent = selection.at(i).parent();-
669 int colCount = model->columnCount(parent);-
670 QModelIndex tl = model->index(selection.at(i).top(), 0, parent);-
671 QModelIndex br = model->index(selection.at(i).bottom(), colCount - 1, parent);-
672 //we need to merge because the same row could have already been inserted-
673 expanded.merge(QItemSelection(tl, br), QItemSelectionModel::Select);-
674 }
executed 513 times by 14 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
513
675 }
executed 519 times by 14 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
519
676 if (command & QItemSelectionModel::Columns) {
command & QIte...Model::ColumnsDescription
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEevaluated 519 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
36-519
677 for (int i = 0; i < selection.count(); ++i) {
i < selection.count()Description
TRUEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
36
678 QModelIndex parent = selection.at(i).parent();-
679 int rowCount = model->rowCount(parent);-
680 QModelIndex tl = model->index(0, selection.at(i).left(), parent);-
681 QModelIndex br = model->index(rowCount - 1, selection.at(i).right(), parent);-
682 //we need to merge because the same column could have already been inserted-
683 expanded.merge(QItemSelection(tl, br), QItemSelectionModel::Select);-
684 }
executed 36 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
36
685 }
executed 36 times by 3 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
36
686 return expanded;
executed 555 times by 14 tests: return expanded;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
555
687}-
688-
689/*!-
690 \internal-
691*/-
692void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &parent,-
693 int start, int end)-
694{-
695 Q_Q(QItemSelectionModel);-
696 finalize();-
697-
698 // update current index-
699 if (currentIndex.isValid() && parent == currentIndex.parent()
currentIndex.isValid()Description
TRUEevaluated 39 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 3549 times by 23 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
parent == curr...Index.parent()Description
TRUEevaluated 26 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QSortFilterProxyModel
  • tst_QTreeView
13-3549
700 && currentIndex.row() >= start && currentIndex.row() <= end) {
currentIndex.row() >= startDescription
TRUEevaluated 16 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 10 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
currentIndex.row() <= endDescription
TRUEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
FALSEevaluated 11 times by 7 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
5-16
701 QModelIndex old = currentIndex;-
702 if (start > 0) // there are rows left above the change
start > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTreeView
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
1-4
703 currentIndex = model->index(start - 1, old.column(), parent);
executed 1 time by 1 test: currentIndex = model->index(start - 1, old.column(), parent);
Executed by:
  • tst_QTreeView
1
704 else if (model && end < model->rowCount(parent) - 1) // there are rows left below the change
end < model->r...nt(parent) - 1Description
TRUEnever evaluated
FALSEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
0-4
705 currentIndex = model->index(end + 1, old.column(), parent);
never executed: currentIndex = model->index(end + 1, old.column(), parent);
0
706 else // there are no rows left in the table-
707 currentIndex = QModelIndex();
executed 4 times by 3 tests: currentIndex = QModelIndex();
Executed by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
4
708 emit q->currentChanged(currentIndex, old);-
709 emit q->currentRowChanged(currentIndex, old);-
710 if (currentIndex.column() != old.column())
currentIndex.c...= old.column()Description
TRUEevaluated 4 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QTreeView
1-4
711 emit q->currentColumnChanged(currentIndex, old);
executed 4 times by 3 tests: q->currentColumnChanged(currentIndex, old);
Executed by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
4
712 }
executed 5 times by 3 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QTreeView
5
713-
714 QItemSelection deselected;-
715 QItemSelection newParts;-
716 QItemSelection::iterator it = ranges.begin();-
717 while (it != ranges.end()) {
it != ranges.end()Description
TRUEevaluated 60 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 3588 times by 24 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
60-3588
718 if (it->topLeft().parent() != parent) { // Check parents until reaching root or contained in range
it->topLeft()....nt() != parentDescription
TRUEevaluated 15 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEevaluated 45 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
15-45
719 QModelIndex itParent = it->topLeft().parent();-
720 while (itParent.isValid() && itParent.parent() != parent)
itParent.isValid()Description
TRUEevaluated 9 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEevaluated 12 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
itParent.parent() != parentDescription
TRUEevaluated 6 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
3-12
721 itParent = itParent.parent();
executed 6 times by 4 tests: itParent = itParent.parent();
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
6
722-
723 if (itParent.isValid() && start <= itParent.row() && itParent.row() <= end) {
itParent.isValid()Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEevaluated 12 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
start <= itParent.row()Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEnever evaluated
itParent.row() <= endDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
FALSEnever evaluated
0-12
724 deselected.append(*it);-
725 it = ranges.erase(it);-
726 } else {
executed 3 times by 3 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
3
727 ++it;-
728 }
executed 12 times by 5 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
12
729 } else if (start <= it->bottom() && it->bottom() <= end // Full inclusion
start <= it->bottom()Description
TRUEevaluated 40 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 5 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
it->bottom() <= endDescription
TRUEevaluated 22 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 18 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
5-40
730 && start <= it->top() && it->top() <= end) {
start <= it->top()Description
TRUEevaluated 20 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
it->top() <= endDescription
TRUEevaluated 20 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
0-20
731 deselected.append(*it);-
732 it = ranges.erase(it);-
733 } else if (start <= it->top() && it->top() <= end) { // Top intersection
executed 20 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
start <= it->top()Description
TRUEevaluated 15 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
FALSEevaluated 10 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
it->top() <= endDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 12 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
3-20
734 deselected.append(QItemSelectionRange(it->topLeft(), model->index(end, it->right(), it->parent())));-
735 *it = QItemSelectionRange(model->index(end + 1, it->left(), it->parent()), it->bottomRight());-
736 ++it;-
737 } else if (start <= it->bottom() && it->bottom() <= end) { // Bottom intersection
executed 3 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
start <= it->bottom()Description
TRUEevaluated 17 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
FALSEevaluated 5 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
it->bottom() <= endDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 15 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
2-17
738 deselected.append(QItemSelectionRange(model->index(start, it->left(), it->parent()), it->bottomRight()));-
739 *it = QItemSelectionRange(it->topLeft(), model->index(start - 1, it->right(), it->parent()));-
740 ++it;-
741 } else if (it->top() < start && end < it->bottom()) { // Middle intersection
executed 2 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
it->top() < startDescription
TRUEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
FALSEevaluated 12 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeWidget
end < it->bottom()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 5 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
2-12
742 // If the parent contains (1, 2, 3, 4, 5, 6, 7, 8) and [3, 4, 5, 6] is selected,-
743 // and [4, 5] is removed, we need to split [3, 4, 5, 6] into [3], [4, 5] and [6].-
744 // [4, 5] is appended to deselected, and [3] and [6] remain part of the selection-
745 // in ranges.-
746 const QItemSelectionRange removedRange(model->index(start, it->left(), it->parent()),-
747 model->index(end, it->right(), it->parent()));-
748 deselected.append(removedRange);-
749 QItemSelection::split(*it, removedRange, &newParts);-
750 it = ranges.erase(it);-
751 } else
executed 3 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
3
752 ++it;
executed 17 times by 9 tests: ++it;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
17
753 }-
754 ranges.append(newParts);-
755-
756 if (!deselected.isEmpty())
!deselected.isEmpty()Description
TRUEevaluated 30 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 3558 times by 24 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
30-3558
757 emit q->selectionChanged(QItemSelection(), deselected);
executed 30 times by 8 tests: q->selectionChanged(QItemSelection(), deselected);
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
30
758}
executed 3588 times by 24 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
3588
759-
760/*!-
761 \internal-
762*/-
763void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent,-
764 int start, int end)-
765{-
766 Q_Q(QItemSelectionModel);-
767-
768 // update current index-
769 if (currentIndex.isValid() && parent == currentIndex.parent()
currentIndex.isValid()Description
TRUEevaluated 11 times by 5 tests
Evaluated by:
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QListView
  • tst_QTableView
FALSEevaluated 287 times by 10 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
parent == curr...Index.parent()Description
TRUEevaluated 11 times by 5 tests
Evaluated by:
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QListView
  • tst_QTableView
FALSEnever evaluated
0-287
770 && currentIndex.column() >= start && currentIndex.column() <= end) {
currentIndex.column() >= startDescription
TRUEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QListView
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QHeaderView
  • tst_QTableView
currentIndex.column() <= endDescription
TRUEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QHeaderView
  • tst_QListView
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
3-8
771 QModelIndex old = currentIndex;-
772 if (start > 0) // there are columns to the left of the change
start > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QListView
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QHeaderView
  • tst_QListView
1-2
773 currentIndex = model->index(old.row(), start - 1, parent);
executed 1 time by 1 test: currentIndex = model->index(old.row(), start - 1, parent);
Executed by:
  • tst_QListView
1
774 else if (model && end < model->columnCount() - 1) // there are columns to the right of the change
end < model->columnCount() - 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QListView
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QHeaderView
1
775 currentIndex = model->index(old.row(), end + 1, parent);
executed 1 time by 1 test: currentIndex = model->index(old.row(), end + 1, parent);
Executed by:
  • tst_QListView
1
776 else // there are no columns left in the table-
777 currentIndex = QModelIndex();
executed 1 time by 1 test: currentIndex = QModelIndex();
Executed by:
  • tst_QHeaderView
1
778 emit q->currentChanged(currentIndex, old);-
779 if (currentIndex.row() != old.row())
currentIndex.r...) != old.row()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QHeaderView
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QListView
1-2
780 emit q->currentRowChanged(currentIndex, old);
executed 1 time by 1 test: q->currentRowChanged(currentIndex, old);
Executed by:
  • tst_QHeaderView
1
781 emit q->currentColumnChanged(currentIndex, old);-
782 }
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QHeaderView
  • tst_QListView
3
783-
784 // update selections-
785 QModelIndex tl = model->index(0, start, parent);-
786 QModelIndex br = model->index(model->rowCount(parent) - 1, end, parent);-
787 q->select(QItemSelection(tl, br), QItemSelectionModel::Deselect);-
788 finalize();-
789}
executed 298 times by 11 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
298
790-
791/*!-
792 \internal-
793-
794 Split selection ranges if columns are about to be inserted in the middle.-
795*/-
796void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &parent,-
797 int start, int end)-
798{-
799 Q_UNUSED(end);-
800 finalize();-
801 QList<QItemSelectionRange> split;-
802 QList<QItemSelectionRange>::iterator it = ranges.begin();-
803 for (; it != ranges.end(); ) {
it != ranges.end()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAccessibility
FALSEevaluated 871 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1-871
804 if ((*it).isValid() && (*it).parent() == parent
(*it).isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAccessibility
FALSEnever evaluated
(*it).parent() == parentDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAccessibility
FALSEnever evaluated
0-1
805 && (*it).left() < start && (*it).right() >= start) {
(*it).left() < startDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAccessibility
FALSEnever evaluated
(*it).right() >= startDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAccessibility
0-1
806 QModelIndex bottomMiddle = model->index((*it).bottom(), start - 1, (*it).parent());-
807 QItemSelectionRange left((*it).topLeft(), bottomMiddle);-
808 QModelIndex topMiddle = model->index((*it).top(), start, (*it).parent());-
809 QItemSelectionRange right(topMiddle, (*it).bottomRight());-
810 it = ranges.erase(it);-
811 split.append(left);-
812 split.append(right);-
813 } else {
never executed: end of block
0
814 ++it;-
815 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QAccessibility
1
816 }-
817 ranges += split;-
818}
executed 871 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
871
819-
820/*!-
821 \internal-
822-
823 Split selection ranges if rows are about to be inserted in the middle.-
824*/-
825void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &parent,-
826 int start, int end)-
827{-
828 Q_UNUSED(end);-
829 finalize();-
830 QList<QItemSelectionRange> split;-
831 QList<QItemSelectionRange>::iterator it = ranges.begin();-
832 for (; it != ranges.end(); ) {
it != ranges.end()Description
TRUEevaluated 3042 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 202721 times by 31 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • ...
3042-202721
833 if ((*it).isValid() && (*it).parent() == parent
(*it).isValid()Description
TRUEevaluated 3042 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEnever evaluated
(*it).parent() == parentDescription
TRUEevaluated 284 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 2758 times by 7 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
0-3042
834 && (*it).top() < start && (*it).bottom() >= start) {
(*it).top() < startDescription
TRUEevaluated 276 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 8 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QItemSelectionModel
(*it).bottom() >= startDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 273 times by 8 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
3-276
835 QModelIndex middleRight = model->index(start - 1, (*it).right(), (*it).parent());-
836 QItemSelectionRange top((*it).topLeft(), middleRight);-
837 QModelIndex middleLeft = model->index(start, (*it).left(), (*it).parent());-
838 QItemSelectionRange bottom(middleLeft, (*it).bottomRight());-
839 it = ranges.erase(it);-
840 split.append(top);-
841 split.append(bottom);-
842 } else {
executed 3 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
3
843 ++it;-
844 }
executed 3039 times by 11 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
3039
845 }-
846 ranges += split;-
847}
executed 202721 times by 31 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • ...
202721
848-
849/*!-
850 \internal-
851-
852 Split selection into individual (persistent) indexes. This is done in-
853 preparation for the layoutChanged() signal, where the indexes can be-
854 merged again.-
855*/-
856void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint hint)-
857{-
858 savedPersistentIndexes.clear();-
859 savedPersistentCurrentIndexes.clear();-
860 savedPersistentRowLengths.clear();-
861 savedPersistentCurrentRowLengths.clear();-
862-
863 // optimization for when all indexes are selected-
864 // (only if there is lots of items (1000) because this is not entirely correct)-
865 if (ranges.isEmpty() && currentSelection.count() == 1) {
ranges.isEmpty()Description
TRUEevaluated 2919 times by 20 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 36 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTreeWidget
currentSelection.count() == 1Description
TRUEevaluated 14 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableWidget
FALSEevaluated 2905 times by 19 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
14-2919
866 QItemSelectionRange range = currentSelection.constFirst();-
867 QModelIndex parent = range.parent();-
868 tableRowCount = model->rowCount(parent);-
869 tableColCount = model->columnCount(parent);-
870 if (tableRowCount * tableColCount > 1000
tableRowCount ...olCount > 1000Description
TRUEnever evaluated
FALSEevaluated 14 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableWidget
0-14
871 && range.top() == 0
range.top() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
872 && range.left() == 0
range.left() == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
873 && range.bottom() == tableRowCount - 1
range.bottom()...leRowCount - 1Description
TRUEnever evaluated
FALSEnever evaluated
0
874 && range.right() == tableColCount - 1) {
range.right() ...leColCount - 1Description
TRUEnever evaluated
FALSEnever evaluated
0
875 tableSelected = true;-
876 tableParent = parent;-
877 return;
never executed: return;
0
878 }-
879 }
executed 14 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableWidget
14
880 tableSelected = false;-
881-
882 if (hint == QAbstractItemModel::VerticalSortHint) {
hint == QAbstr...rticalSortHintDescription
TRUEevaluated 125 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 2830 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
125-2830
883 // Special case when we know we're sorting vertically. We can assume that all indexes for columns-
884 // are displaced the same way, and therefore we only need to track an index from one column per-
885 // row with a QPersistentModelIndex together with the length of items to the right of it-
886 // which are displaced the same way.-
887 // An algorithm which contains the same assumption is used to process layoutChanged.-
888 savedPersistentRowLengths = qSelectionPersistentRowLengths(ranges);-
889 savedPersistentCurrentRowLengths = qSelectionPersistentRowLengths(currentSelection);-
890 } else {
executed 125 times by 9 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
125
891 savedPersistentIndexes = qSelectionIndexes<QVector<QPersistentModelIndex>>(ranges);-
892 savedPersistentCurrentIndexes = qSelectionIndexes<QVector<QPersistentModelIndex>>(currentSelection);-
893 }
executed 2830 times by 16 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
2830
894}-
895/*!-
896 \internal-
897*/-
898static QItemSelection mergeRowLengths(const QVector<QPair<QPersistentModelIndex, uint> > &rowLengths)-
899{-
900 if (rowLengths.isEmpty())
rowLengths.isEmpty()Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
8-12
901 return QItemSelection();
executed 8 times by 2 tests: return QItemSelection();
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
8
902-
903 QItemSelection result;-
904 int i = 0;-
905 while (i < rowLengths.count()) {
i < rowLengths.count()Description
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
12-13
906 const QPersistentModelIndex &tl = rowLengths.at(i).first;-
907 if (!tl.isValid()) {
!tl.isValid()Description
TRUEnever evaluated
FALSEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
0-13
908 ++i;-
909 continue;
never executed: continue;
0
910 }-
911 QPersistentModelIndex br = tl;-
912 const uint length = rowLengths.at(i).second;-
913 while (++i < rowLengths.count()) {
++i < rowLengths.count()Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
11-12
914 const QPersistentModelIndex &next = rowLengths.at(i).first;-
915 if (!next.isValid())
!next.isValid()Description
TRUEnever evaluated
FALSEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
0-11
916 continue;
never executed: continue;
0
917 const uint nextLength = rowLengths.at(i).second;-
918 if ((nextLength == length)
(nextLength == length)Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEnever evaluated
0-11
919 && (next.row() == br.row() + 1)
(next.row() == br.row() + 1)Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QItemSelectionModel
1-10
920 && (next.parent() == br.parent())) {
(next.parent() == br.parent())Description
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEnever evaluated
0-10
921 br = next;-
922 } else {
executed 10 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
10
923 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QItemSelectionModel
1
924 }-
925 }-
926 result.append(QItemSelectionRange(tl, br.sibling(br.row(), length - 1)));-
927 }
executed 13 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
13
928 return result;
executed 12 times by 2 tests: return result;
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
12
929}-
930-
931/*!-
932 \internal-
933-
934 Merges \a indexes into an item selection made up of ranges.-
935 Assumes that the indexes are sorted.-
936*/-
937static QItemSelection mergeIndexes(const QVector<QPersistentModelIndex> &indexes)-
938{-
939 QItemSelection colSpans;-
940 // merge columns-
941 int i = 0;-
942 while (i < indexes.count()) {
i < indexes.count()Description
TRUEevaluated 110 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 80 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
80-110
943 const QPersistentModelIndex &tl = indexes.at(i);-
944 if (!tl.isValid()) {
!tl.isValid()Description
TRUEnever evaluated
FALSEevaluated 110 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
0-110
945 ++i;-
946 continue;
never executed: continue;
0
947 }-
948 QPersistentModelIndex br = tl;-
949 QModelIndex brParent = br.parent();-
950 int brRow = br.row();-
951 int brColumn = br.column();-
952 while (++i < indexes.count()) {
++i < indexes.count()Description
TRUEevaluated 585 times by 7 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 48 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
48-585
953 const QPersistentModelIndex &next = indexes.at(i);-
954 if (!next.isValid())
!next.isValid()Description
TRUEnever evaluated
FALSEevaluated 585 times by 7 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
0-585
955 continue;
never executed: continue;
0
956 const QModelIndex nextParent = next.parent();-
957 const int nextRow = next.row();-
958 const int nextColumn = next.column();-
959 if ((nextParent == brParent)
(nextParent == brParent)Description
TRUEevaluated 543 times by 7 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QFiledialog
  • tst_QStandardItemModel
42-543
960 && (nextRow == brRow)
(nextRow == brRow)Description
TRUEevaluated 523 times by 7 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
20-523
961 && (nextColumn == brColumn + 1)) {
(nextColumn == brColumn + 1)Description
TRUEevaluated 523 times by 7 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEnever evaluated
0-523
962 br = next;-
963 brParent = nextParent;-
964 brRow = nextRow;-
965 brColumn = nextColumn;-
966 } else {
executed 523 times by 7 tests: end of block
Executed by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
523
967 break;
executed 62 times by 3 tests: break;
Executed by:
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
62
968 }-
969 }-
970 colSpans.append(QItemSelectionRange(tl, br));-
971 }
executed 110 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
110
972 // merge rows-
973 QItemSelection rowSpans;-
974 i = 0;-
975 while (i < colSpans.count()) {
i < colSpans.count()Description
TRUEevaluated 104 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 80 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
80-104
976 QModelIndex tl = colSpans.at(i).topLeft();-
977 QModelIndex br = colSpans.at(i).bottomRight();-
978 QModelIndex prevTl = tl;-
979 while (++i < colSpans.count()) {
++i < colSpans.count()Description
TRUEevaluated 62 times by 3 tests
Evaluated by:
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
FALSEevaluated 48 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
48-62
980 QModelIndex nextTl = colSpans.at(i).topLeft();-
981 QModelIndex nextBr = colSpans.at(i).bottomRight();-
982-
983 if (nextTl.parent() != tl.parent())
nextTl.parent() != tl.parent()Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QFiledialog
  • tst_QStandardItemModel
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
20-42
984 break; // we can't merge selection ranges from different parents
executed 42 times by 2 tests: break;
Executed by:
  • tst_QFiledialog
  • tst_QStandardItemModel
42
985-
986 if ((nextTl.column() == prevTl.column()) && (nextBr.column() == br.column())
(nextTl.column...evTl.column())Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
FALSEnever evaluated
(nextBr.column...= br.column())Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
FALSEnever evaluated
0-20
987 && (nextTl.row() == prevTl.row() + 1) && (nextBr.row() == br.row() + 1)) {
(nextTl.row() ...vTl.row() + 1)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStandardItemModel
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
(nextBr.row() == br.row() + 1)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QStandardItemModel
FALSEnever evaluated
0-14
988 br = nextBr;-
989 prevTl = nextTl;-
990 } else {
executed 6 times by 1 test: end of block
Executed by:
  • tst_QStandardItemModel
6
991 break;
executed 14 times by 1 test: break;
Executed by:
  • tst_QItemSelectionModel
14
992 }-
993 }-
994 rowSpans.append(QItemSelectionRange(tl, br));-
995 }
executed 104 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
104
996 return rowSpans;
executed 80 times by 8 tests: return rowSpans;
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
80
997}-
998-
999/*!-
1000 \internal-
1001-
1002 Sort predicate function for QItemSelectionModelPrivate::_q_layoutChanged(),-
1003 sorting by parent first in addition to operator<(). This is to prevent-
1004 fragmentation of the selection by grouping indexes with the same row, column-
1005 of different parents next to each other, which may happen when a selection-
1006 spans sub-trees.-
1007*/-
1008static bool qt_PersistentModelIndexLessThan(const QPersistentModelIndex &i1, const QPersistentModelIndex &i2)-
1009{-
1010 const QModelIndex parent1 = i1.parent();-
1011 const QModelIndex parent2 = i2.parent();-
1012 return parent1 == parent2 ? i1 < i2 : parent1 < parent2;
executed 2243 times by 7 tests: return parent1 == parent2 ? i1 < i2 : parent1 < parent2;
Executed by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
2243
1013}-
1014-
1015/*!-
1016 \internal-
1017-
1018 Merge the selected indexes into selection ranges again.-
1019*/-
1020void QItemSelectionModelPrivate::_q_layoutChanged(const QList<QPersistentModelIndex> &, QAbstractItemModel::LayoutChangeHint hint)-
1021{-
1022 // special case for when all indexes are selected-
1023 if (tableSelected && tableColCount == model->columnCount(tableParent)
tableSelectedDescription
TRUEnever evaluated
FALSEevaluated 2956 times by 20 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
tableColCount ...t(tableParent)Description
TRUEnever evaluated
FALSEnever evaluated
0-2956
1024 && tableRowCount == model->rowCount(tableParent)) {
tableRowCount ...t(tableParent)Description
TRUEnever evaluated
FALSEnever evaluated
0
1025 ranges.clear();-
1026 currentSelection.clear();-
1027 int bottom = tableRowCount - 1;-
1028 int right = tableColCount - 1;-
1029 QModelIndex tl = model->index(0, 0, tableParent);-
1030 QModelIndex br = model->index(bottom, right, tableParent);-
1031 currentSelection << QItemSelectionRange(tl, br);-
1032 tableParent = QModelIndex();-
1033 tableSelected = false;-
1034 return;
never executed: return;
0
1035 }-
1036-
1037 if ((hint != QAbstractItemModel::VerticalSortHint && savedPersistentCurrentIndexes.isEmpty() && savedPersistentIndexes.isEmpty())
hint != QAbstr...rticalSortHintDescription
TRUEevaluated 2831 times by 17 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 125 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
savedPersisten...exes.isEmpty()Description
TRUEevaluated 2814 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 17 times by 5 tests
Evaluated by:
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableWidget
savedPersisten...exes.isEmpty()Description
TRUEevaluated 2791 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 23 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QStandardItemModel
  • tst_QTreeWidget
17-2831
1038 || (hint == QAbstractItemModel::VerticalSortHint && savedPersistentRowLengths.isEmpty() && savedPersistentCurrentRowLengths.isEmpty())) {
hint == QAbstr...rticalSortHintDescription
TRUEevaluated 125 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 40 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
savedPersisten...gths.isEmpty()Description
TRUEevaluated 120 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
savedPersisten...gths.isEmpty()Description
TRUEevaluated 115 times by 7 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
5-125
1039 // either the selection was actually empty, or we-
1040 // didn't get the layoutAboutToBeChanged() signal-
1041 return;
executed 2906 times by 19 tests: return;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
2906
1042 }-
1043-
1044 // clear the "old" selection-
1045 ranges.clear();-
1046 currentSelection.clear();-
1047-
1048 if (hint != QAbstractItemModel::VerticalSortHint) {
hint != QAbstr...rticalSortHintDescription
TRUEevaluated 40 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
10-40
1049 // sort the "new" selection, as preparation for merging-
1050 std::stable_sort(savedPersistentIndexes.begin(), savedPersistentIndexes.end(),-
1051 qt_PersistentModelIndexLessThan);-
1052 std::stable_sort(savedPersistentCurrentIndexes.begin(), savedPersistentCurrentIndexes.end(),-
1053 qt_PersistentModelIndexLessThan);-
1054-
1055 // update the selection by merging the individual indexes-
1056 ranges = mergeIndexes(savedPersistentIndexes);-
1057 currentSelection = mergeIndexes(savedPersistentCurrentIndexes);-
1058-
1059 // release the persistent indexes-
1060 savedPersistentIndexes.clear();-
1061 savedPersistentCurrentIndexes.clear();-
1062 } else {
executed 40 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
40
1063 // sort the "new" selection, as preparation for merging-
1064 std::stable_sort(savedPersistentRowLengths.begin(), savedPersistentRowLengths.end());-
1065 std::stable_sort(savedPersistentCurrentRowLengths.begin(), savedPersistentCurrentRowLengths.end());-
1066-
1067 // update the selection by merging the individual indexes-
1068 ranges = mergeRowLengths(savedPersistentRowLengths);-
1069 currentSelection = mergeRowLengths(savedPersistentCurrentRowLengths);-
1070-
1071 // release the persistent indexes-
1072 savedPersistentRowLengths.clear();-
1073 savedPersistentCurrentRowLengths.clear();-
1074 }
executed 10 times by 2 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
10
1075}-
1076-
1077/*!-
1078 \class QItemSelectionModel-
1079 \inmodule QtCore-
1080-
1081 \brief The QItemSelectionModel class keeps track of a view's selected items.-
1082-
1083 \ingroup model-view-
1084-
1085 A QItemSelectionModel keeps track of the selected items in a view, or-
1086 in several views onto the same model. It also keeps track of the-
1087 currently selected item in a view.-
1088-
1089 The QItemSelectionModel class is one of the \l{Model/View Classes}-
1090 and is part of Qt's \l{Model/View Programming}{model/view framework}.-
1091-
1092 The selected items are stored using ranges. Whenever you want to-
1093 modify the selected items use select() and provide either a-
1094 QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.-
1095-
1096 The QItemSelectionModel takes a two layer approach to selection-
1097 management, dealing with both selected items that have been committed-
1098 and items that are part of the current selection. The current-
1099 selected items are part of the current interactive selection (for-
1100 example with rubber-band selection or keyboard-shift selections).-
1101-
1102 To update the currently selected items, use the bitwise OR of-
1103 QItemSelectionModel::Current and any of the other SelectionFlags.-
1104 If you omit the QItemSelectionModel::Current command, a new current-
1105 selection will be created, and the previous one added to the whole-
1106 selection. All functions operate on both layers; for example,-
1107 \l {QTableWidget::selectedItems()}{selecteditems()} will return items from both layers.-
1108-
1109 \note Since 5.5, \l{QItemSelectionModel::model()}{model},-
1110 \l{QItemSelectionModel::hasSelection()}{hasSelection}, and-
1111 \l{QItemSelectionModel::currentIndex()}{currentIndex} are meta-object properties.-
1112-
1113 \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}-
1114*/-
1115-
1116/*!-
1117 Constructs a selection model that operates on the specified item \a model.-
1118*/-
1119QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)-
1120 : QObject(*new QItemSelectionModelPrivate, model)-
1121{-
1122 d_func()->initModel(model);-
1123}
executed 93 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
93
1124-
1125/*!-
1126 Constructs a selection model that operates on the specified item \a model with \a parent.-
1127*/-
1128QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)-
1129 : QObject(*new QItemSelectionModelPrivate, parent)-
1130{-
1131 d_func()->initModel(model);-
1132}
executed 4915 times by 42 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
4915
1133-
1134/*!-
1135 \internal-
1136*/-
1137QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model)-
1138 : QObject(dd, model)-
1139{-
1140 dd.initModel(model);-
1141}
never executed: end of block
0
1142-
1143/*!-
1144 Destroys the selection model.-
1145*/-
1146QItemSelectionModel::~QItemSelectionModel()-
1147{-
1148}-
1149-
1150/*!-
1151 Selects the model item \a index using the specified \a command, and emits-
1152 selectionChanged().-
1153-
1154 \sa QItemSelectionModel::SelectionFlags-
1155*/-
1156void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)-
1157{-
1158 QItemSelection selection(index, index);-
1159 select(selection, command);-
1160}
executed 3834 times by 27 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
3834
1161-
1162/*!-
1163 \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)-
1164-
1165 This signal is emitted whenever the current item changes. The \a previous-
1166 model item index is replaced by the \a current index as the selection's-
1167 current item.-
1168-
1169 Note that this signal will not be emitted when the item model is reset.-
1170-
1171 \sa currentIndex(), setCurrentIndex(), selectionChanged()-
1172*/-
1173-
1174/*!-
1175 \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)-
1176-
1177 This signal is emitted if the \a current item changes and its column is-
1178 different to the column of the \a previous current item.-
1179-
1180 Note that this signal will not be emitted when the item model is reset.-
1181-
1182 \sa currentChanged(), currentRowChanged(), currentIndex(), setCurrentIndex()-
1183*/-
1184-
1185/*!-
1186 \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)-
1187-
1188 This signal is emitted if the \a current item changes and its row is-
1189 different to the row of the \a previous current item.-
1190-
1191 Note that this signal will not be emitted when the item model is reset.-
1192-
1193 \sa currentChanged(), currentColumnChanged(), currentIndex(), setCurrentIndex()-
1194*/-
1195-
1196/*!-
1197 \fn void QItemSelectionModel::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)-
1198-
1199 This signal is emitted whenever the selection changes. The change in the-
1200 selection is represented as an item selection of \a deselected items and-
1201 an item selection of \a selected items.-
1202-
1203 Note the that the current index changes independently from the selection.-
1204 Also note that this signal will not be emitted when the item model is reset.-
1205-
1206 \sa select(), currentChanged()-
1207*/-
1208-
1209/*!-
1210 \fn void QItemSelectionModel::modelChanged(QAbstractItemModel *model)-
1211 \since 5.5-
1212-
1213 This signal is emitted when the \a model is successfully set with setModel().-
1214-
1215 \sa model(), setModel()-
1216*/-
1217-
1218-
1219/*!-
1220 \enum QItemSelectionModel::SelectionFlag-
1221-
1222 This enum describes the way the selection model will be updated.-
1223-
1224 \value NoUpdate No selection will be made.-
1225 \value Clear The complete selection will be cleared.-
1226 \value Select All specified indexes will be selected.-
1227 \value Deselect All specified indexes will be deselected.-
1228 \value Toggle All specified indexes will be selected or-
1229 deselected depending on their current state.-
1230 \value Current The current selection will be updated.-
1231 \value Rows All indexes will be expanded to span rows.-
1232 \value Columns All indexes will be expanded to span columns.-
1233 \value SelectCurrent A combination of Select and Current, provided for-
1234 convenience.-
1235 \value ToggleCurrent A combination of Toggle and Current, provided for-
1236 convenience.-
1237 \value ClearAndSelect A combination of Clear and Select, provided for-
1238 convenience.-
1239*/-
1240-
1241/*!-
1242 Selects the item \a selection using the specified \a command, and emits-
1243 selectionChanged().-
1244-
1245 \sa QItemSelectionModel::SelectionFlag-
1246*/-
1247void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)-
1248{-
1249 Q_D(QItemSelectionModel);-
1250 if (!d->model) {
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 7345 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
0-7345
1251 qWarning("QItemSelectionModel: Selecting when no model has been set will result in a no-op.");-
1252 return;
never executed: return;
0
1253 }-
1254 if (command == NoUpdate)
command == NoUpdateDescription
TRUEevaluated 45 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTreeWidget
FALSEevaluated 7300 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
45-7300
1255 return;
executed 45 times by 5 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTreeWidget
45
1256-
1257 // store old selection-
1258 QItemSelection sel = selection;-
1259 // If d->ranges is non-empty when the source model is reset the persistent indexes-
1260 // it contains will be invalid. We can't clear them in a modelReset slot because that might already-
1261 // be too late if another model observer is connected to the same modelReset slot and is invoked first-
1262 // it might call select() on this selection model before any such QItemSelectionModelPrivate::_q_modelReset() slot-
1263 // is invoked, so it would not be cleared yet. We clear it invalid ranges in it here.-
1264 QItemSelection::iterator it = d->ranges.begin();-
1265 while (it != d->ranges.end()) {
it != d->ranges.end()Description
TRUEevaluated 1187 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 7300 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
1187-7300
1266 if (!it->isValid())
!it->isValid()Description
TRUEevaluated 24 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 1163 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
24-1163
1267 it = d->ranges.erase(it);
executed 24 times by 4 tests: it = d->ranges.erase(it);
Executed by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
24
1268 else-
1269 ++it;
executed 1163 times by 15 tests: ++it;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1163
1270 }-
1271-
1272 QItemSelection old = d->ranges;-
1273 old.merge(d->currentSelection, d->currentCommand);-
1274-
1275 // expand selection according to SelectionBehavior-
1276 if (command & Rows || command & Columns)-
1277 sel = d->expandSelection(sel, command);
executed 555 times by 14 tests: sel = d->expandSelection(sel, command);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
555
1278-
1279 // clear ranges and currentSelection-
1280 if (command & Clear) {
command & ClearDescription
TRUEevaluated 5312 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
FALSEevaluated 1988 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • ...
1988-5312
1281 d->ranges.clear();-
1282 d->currentSelection.clear();-
1283 }
executed 5312 times by 27 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
5312
1284-
1285 // merge and clear currentSelection if Current was not set (ie. start new currentSelection)-
1286 if (!(command & Current))
!(command & Current)Description
TRUEevaluated 6537 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
FALSEevaluated 763 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
763-6537
1287 d->finalize();
executed 6537 times by 29 tests: d->finalize();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
6537
1288-
1289 // update currentSelection-
1290 if (command & Toggle || command & Select || command & Deselect) {-
1291 d->currentCommand = command;-
1292 d->currentSelection = sel;-
1293 }
executed 5792 times by 29 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
5792
1294-
1295 // generate new selection, compare with old and emit selectionChanged()-
1296 QItemSelection newSelection = d->ranges;-
1297 newSelection.merge(d->currentSelection, d->currentCommand);-
1298 emitSelectionChanged(newSelection, old);-
1299}
executed 7300 times by 29 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
7300
1300-
1301/*!-
1302 Clears the selection model. Emits selectionChanged() and currentChanged().-
1303*/-
1304void QItemSelectionModel::clear()-
1305{-
1306 clearSelection();-
1307 clearCurrentIndex();-
1308}
executed 12275 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
12275
1309-
1310/*!-
1311 Clears the current index. Emits currentChanged().-
1312 */-
1313void QItemSelectionModel::clearCurrentIndex()-
1314{-
1315 Q_D(QItemSelectionModel);-
1316 QModelIndex previous = d->currentIndex;-
1317 d->currentIndex = QModelIndex();-
1318 if (previous.isValid()) {
previous.isValid()Description
TRUEevaluated 880 times by 12 tests
Evaluated by:
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 11398 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
880-11398
1319 emit currentChanged(d->currentIndex, previous);-
1320 emit currentRowChanged(d->currentIndex, previous);-
1321 emit currentColumnChanged(d->currentIndex, previous);-
1322 }
executed 880 times by 12 tests: end of block
Executed by:
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTreeWidget
  • tst_languageChange
880
1323}
executed 12278 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
12278
1324-
1325/*!-
1326 Clears the selection model. Does not emit any signals.-
1327*/-
1328void QItemSelectionModel::reset()-
1329{-
1330 const QSignalBlocker blocker(this);-
1331 clear();-
1332}
executed 9635 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
9635
1333-
1334/*!-
1335 \since 4.2-
1336 Clears the selection in the selection model. Emits selectionChanged().-
1337*/-
1338void QItemSelectionModel::clearSelection()-
1339{-
1340 Q_D(QItemSelectionModel);-
1341 if (d->ranges.count() == 0 && d->currentSelection.count() == 0)
d->ranges.count() == 0Description
TRUEevaluated 12268 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 66 times by 9 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
d->currentSele...n.count() == 0Description
TRUEevaluated 10878 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 1390 times by 22 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
66-12268
1342 return;
executed 10878 times by 43 tests: return;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
10878
1343-
1344 select(QItemSelection(), Clear);-
1345}
executed 1456 times by 23 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
1456
1346-
1347-
1348/*!-
1349 Sets the model item \a index to be the current item, and emits-
1350 currentChanged(). The current item is used for keyboard navigation and-
1351 focus indication; it is independent of any selected items, although a-
1352 selected item can also be the current item.-
1353-
1354 Depending on the specified \a command, the \a index can also become part-
1355 of the current selection.-
1356 \sa select()-
1357*/-
1358void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)-
1359{-
1360 Q_D(QItemSelectionModel);-
1361 if (!d->model) {
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 4212 times by 28 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • ...
0-4212
1362 qWarning("QItemSelectionModel: Setting the current index when no model has been set will result in a no-op.");-
1363 return;
never executed: return;
0
1364 }-
1365 if (index == d->currentIndex) {
index == d->currentIndexDescription
TRUEevaluated 255 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 3957 times by 28 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • ...
255-3957
1366 if (command != NoUpdate)
command != NoUpdateDescription
TRUEevaluated 145 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 110 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QItemView
  • tst_QListView
  • tst_QTreeView
  • tst_QTreeWidget
110-145
1367 select(index, command); // select item
executed 145 times by 15 tests: select(index, command);
Executed by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
145
1368 return;
executed 255 times by 17 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
255
1369 }-
1370 QPersistentModelIndex previous = d->currentIndex;-
1371 d->currentIndex = index; // set current before emitting selection changed below-
1372 if (command != NoUpdate)
command != NoUpdateDescription
TRUEevaluated 2956 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 1001 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
1001-2956
1373 select(d->currentIndex, command); // select item
executed 2956 times by 25 tests: select(d->currentIndex, command);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
2956
1374 emit currentChanged(d->currentIndex, previous);-
1375 if (d->currentIndex.row() != previous.row() ||
d->currentInde...previous.row()Description
TRUEevaluated 3320 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
FALSEevaluated 637 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
637-3320
1376 d->currentIndex.parent() != previous.parent())
d->currentInde...vious.parent()Description
TRUEevaluated 50 times by 5 tests
Evaluated by:
  • tst_QColumnView
  • tst_QComboBox
  • tst_QItemSelectionModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 587 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
50-587
1377 emit currentRowChanged(d->currentIndex, previous);
executed 3370 times by 26 tests: currentRowChanged(d->currentIndex, previous);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
3370
1378 if (d->currentIndex.column() != previous.column() ||
d->currentInde...vious.column()Description
TRUEevaluated 2038 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
FALSEevaluated 1919 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1919-2038
1379 d->currentIndex.parent() != previous.parent())
d->currentInde...vious.parent()Description
TRUEevaluated 76 times by 7 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1843 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
76-1843
1380 emit currentColumnChanged(d->currentIndex, previous);
executed 2114 times by 26 tests: currentColumnChanged(d->currentIndex, previous);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
2114
1381}
executed 3957 times by 28 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • ...
3957
1382-
1383/*!-
1384 Returns the model item index for the current item, or an invalid index-
1385 if there is no current item.-
1386*/-
1387QModelIndex QItemSelectionModel::currentIndex() const-
1388{-
1389 return static_cast<QModelIndex>(d_func()->currentIndex);
executed 38936 times by 42 tests: return static_cast<QModelIndex>(d_func()->currentIndex);
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
38936
1390}-
1391-
1392/*!-
1393 Returns \c true if the given model item \a index is selected.-
1394*/-
1395bool QItemSelectionModel::isSelected(const QModelIndex &index) const-
1396{-
1397 Q_D(const QItemSelectionModel);-
1398 if (d->model != index.model() || !index.isValid())
d->model != index.model()Description
TRUEevaluated 20 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QTreeView
FALSEevaluated 28592 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
!index.isValid()Description
TRUEnever evaluated
FALSEevaluated 28592 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
0-28592
1399 return false;
executed 20 times by 5 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QTreeView
20
1400-
1401 bool selected = false;-
1402 // search model ranges-
1403 QList<QItemSelectionRange>::const_iterator it = d->ranges.begin();-
1404 for (; it != d->ranges.end(); ++it) {
it != d->ranges.end()Description
TRUEevaluated 5490 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 28034 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
5490-28034
1405 if ((*it).isValid() && (*it).contains(index)) {
(*it).isValid()Description
TRUEevaluated 5490 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QTableView
  • tst_QTreeView
FALSEnever evaluated
(*it).contains(index)Description
TRUEevaluated 558 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 4932 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListWidget
  • tst_QTableView
0-5490
1406 selected = true;-
1407 break;
executed 558 times by 9 tests: break;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QTableView
  • tst_QTreeView
558
1408 }-
1409 }
executed 4932 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListWidget
  • tst_QTableView
4932
1410-
1411 // check currentSelection-
1412 if (d->currentSelection.count()) {
d->currentSelection.count()Description
TRUEevaluated 9209 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 19383 times by 22 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
9209-19383
1413 if ((d->currentCommand & Deselect) && selected)
selectedDescription
TRUEevaluated 185 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 90 times by 3 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
90-185
1414 selected = !d->currentSelection.contains(index);
executed 185 times by 5 tests: selected = !d->currentSelection.contains(index);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
185
1415 else if (d->currentCommand & Toggle)
d->currentCommand & ToggleDescription
TRUEevaluated 75 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEevaluated 8949 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
75-8949
1416 selected ^= d->currentSelection.contains(index);
executed 75 times by 2 tests: selected ^= d->currentSelection.contains(index);
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
75
1417 else if ((d->currentCommand & Select) && !selected)
!selectedDescription
TRUEevaluated 8702 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 157 times by 6 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListWidget
  • tst_QTableView
  • tst_QTreeView
157-8702
1418 selected = d->currentSelection.contains(index);
executed 8702 times by 21 tests: selected = d->currentSelection.contains(index);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
8702
1419 }
executed 9209 times by 21 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
9209
1420-
1421 if (selected) {
selectedDescription
TRUEevaluated 1826 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 26766 times by 24 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1826-26766
1422 Qt::ItemFlags flags = d->model->flags(index);-
1423 return (flags & Qt::ItemIsSelectable);
executed 1826 times by 21 tests: return (flags & Qt::ItemIsSelectable);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
1826
1424 }-
1425-
1426 return false;
executed 26766 times by 24 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
26766
1427}-
1428-
1429/*!-
1430 Returns \c true if all items are selected in the \a row with the given-
1431 \a parent.-
1432-
1433 Note that this function is usually faster than calling isSelected()-
1434 on all items in the same row and that unselectable items are-
1435 ignored.-
1436*/-
1437bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) const-
1438{-
1439 Q_D(const QItemSelectionModel);-
1440 if (!d->model)
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 1940 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
0-1940
1441 return false;
never executed: return false;
0
1442 if (parent.isValid() && d->model != parent.model())
parent.isValid()Description
TRUEevaluated 849 times by 4 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTreeView
FALSEevaluated 1091 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
d->model != parent.model()Description
TRUEnever evaluated
FALSEevaluated 849 times by 4 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTreeView
0-1091
1443 return false;
never executed: return false;
0
1444-
1445 // return false if row exist in currentSelection (Deselect)-
1446 if (d->currentCommand & Deselect && d->currentSelection.count()) {
d->currentSelection.count()Description
TRUEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-81
1447 for (int i=0; i<d->currentSelection.count(); ++i) {
i<d->currentSelection.count()Description
TRUEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 60 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
60-81
1448 if (d->currentSelection.at(i).parent() == parent &&
d->currentSele...nt() == parentDescription
TRUEevaluated 81 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-81
1449 row >= d->currentSelection.at(i).top() &&
row >= d->curr...on.at(i).top()Description
TRUEevaluated 49 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 32 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
32-49
1450 row <= d->currentSelection.at(i).bottom())
row <= d->curr...at(i).bottom()Description
TRUEevaluated 21 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_QItemView
21-28
1451 return false;
executed 21 times by 3 tests: return false;
Executed by:
  • tst_QAccessibility
  • tst_QItemView
  • tst_QTableView
21
1452 }
executed 60 times by 2 tests: end of block
Executed by:
  • tst_QItemView
  • tst_QTableView
60
1453 }
executed 60 times by 2 tests: end of block
Executed by:
  • tst_QItemView
  • tst_QTableView
60
1454 // return false if ranges in both currentSelection and ranges-
1455 // intersect and have the same row contained-
1456 if (d->currentCommand & Toggle && d->currentSelection.count()) {
d->currentSelection.count()Description
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEnever evaluated
0-22
1457 for (int i=0; i<d->currentSelection.count(); ++i)
i<d->currentSelection.count()Description
TRUEevaluated 22 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEevaluated 22 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
22
1458 if (d->currentSelection.at(i).top() <= row &&
d->currentSele...).top() <= rowDescription
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
10-12
1459 d->currentSelection.at(i).bottom() >= row)
d->currentSele...ottom() >= rowDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_QFiledialog
  • tst_QItemSelectionModel
2-10
1460 for (int j=0; j<d->ranges.count(); ++j)
j<d->ranges.count()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
0-2
1461 if (d->ranges.at(j).top() <= row && d->ranges.at(j).bottom() >= row
d->ranges.at(j).top() <= rowDescription
TRUEnever evaluated
FALSEnever evaluated
d->ranges.at(j...ottom() >= rowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1462 && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid())
d->currentSele...(j)).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1463 return false;
never executed: return false;
0
1464 }
executed 22 times by 3 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QFiledialog
  • tst_QItemSelectionModel
22
1465 // add ranges and currentSelection and check through them all-
1466 QList<QItemSelectionRange>::const_iterator it;-
1467 QList<QItemSelectionRange> joined = d->ranges;-
1468 if (d->currentSelection.count())
d->currentSelection.count()Description
TRUEevaluated 1237 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
FALSEevaluated 682 times by 5 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemView
  • tst_QTreeWidget
682-1237
1469 joined += d->currentSelection;
executed 1237 times by 9 tests: joined += d->currentSelection;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
1237
1470 int colCount = d->model->columnCount(parent);-
1471 for (int column = 0; column < colCount; ++column) {
column < colCountDescription
TRUEevaluated 2117 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1027 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1027-2117
1472 for (it = joined.constBegin(); it != joined.constEnd(); ++it) {
it != joined.constEnd()Description
TRUEevaluated 5428 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 892 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
892-5428
1473 if ((*it).contains(row, column, parent)) {
(*it).contains...olumn, parent)Description
TRUEevaluated 1235 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 4193 times by 7 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
1235-4193
1474 bool selectable = false;-
1475 for (int i = column; !selectable && i <= (*it).right(); ++i) {
!selectableDescription
TRUEevaluated 1246 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1225 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
i <= (*it).right()Description
TRUEevaluated 1236 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
10-1246
1476 Qt::ItemFlags flags = d->model->index(row, i, parent).flags();-
1477 selectable = flags & Qt::ItemIsSelectable;-
1478 }
executed 1236 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1236
1479 if (selectable){
selectableDescription
TRUEevaluated 1225 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
10-1225
1480 column = qMax(column, (*it).right());-
1481 break;
executed 1225 times by 10 tests: break;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1225
1482 }-
1483 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
10
1484 }
executed 4203 times by 7 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
4203
1485 if (it == joined.constEnd())
it == joined.constEnd()Description
TRUEevaluated 892 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 1225 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
892-1225
1486 return false;
executed 892 times by 5 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
892
1487 }
executed 1225 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1225
1488 return colCount > 0; // no columns means no selected items
executed 1027 times by 9 tests: return colCount > 0;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1027
1489}-
1490-
1491/*!-
1492 Returns \c true if all items are selected in the \a column with the given-
1493 \a parent.-
1494-
1495 Note that this function is usually faster than calling isSelected()-
1496 on all items in the same column and that unselectable items are-
1497 ignored.-
1498*/-
1499bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const-
1500{-
1501 Q_D(const QItemSelectionModel);-
1502 if (!d->model)
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 1030 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
0-1030
1503 return false;
never executed: return false;
0
1504 if (parent.isValid() && d->model != parent.model())
parent.isValid()Description
TRUEevaluated 60 times by 3 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
FALSEevaluated 970 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
d->model != parent.model()Description
TRUEnever evaluated
FALSEevaluated 60 times by 3 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
0-970
1505 return false;
never executed: return false;
0
1506-
1507 // return false if column exist in currentSelection (Deselect)-
1508 if (d->currentCommand & Deselect && d->currentSelection.count()) {
d->currentSelection.count()Description
TRUEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-46
1509 for (int i = 0; i < d->currentSelection.count(); ++i) {
i < d->current...ection.count()Description
TRUEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
27-46
1510 if (d->currentSelection.at(i).parent() == parent &&
d->currentSele...nt() == parentDescription
TRUEevaluated 46 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
FALSEnever evaluated
0-46
1511 column >= d->currentSelection.at(i).left() &&
column >= d->c...n.at(i).left()Description
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
12-34
1512 column <= d->currentSelection.at(i).right())
column <= d->c....at(i).right()Description
TRUEevaluated 19 times by 2 tests
Evaluated by:
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QItemView
15-19
1513 return false;
executed 19 times by 2 tests: return false;
Executed by:
  • tst_QItemView
  • tst_QTableView
19
1514 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QItemView
  • tst_QTableView
27
1515 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QItemView
  • tst_QTableView
27
1516 // return false if ranges in both currentSelection and the selection model-
1517 // intersect and have the same column contained-
1518 if (d->currentCommand & Toggle && d->currentSelection.count()) {
d->currentSelection.count()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
FALSEnever evaluated
0-6
1519 for (int i = 0; i < d->currentSelection.count(); ++i) {
i < d->current...ection.count()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
6
1520 if (d->currentSelection.at(i).left() <= column &&
d->currentSele...ft() <= columnDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
FALSEnever evaluated
0-6
1521 d->currentSelection.at(i).right() >= column) {
d->currentSele...ht() >= columnDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
2-4
1522 for (int j = 0; j < d->ranges.count(); ++j) {
j < d->ranges.count()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
0-2
1523 if (d->ranges.at(j).left() <= column && d->ranges.at(j).right() >= column
d->ranges.at(j...ft() <= columnDescription
TRUEnever evaluated
FALSEnever evaluated
d->ranges.at(j...ht() >= columnDescription
TRUEnever evaluated
FALSEnever evaluated
0
1524 && d->currentSelection.at(i).intersected(d->ranges.at(j)).isValid()) {
d->currentSele...(j)).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1525 return false;
never executed: return false;
0
1526 }-
1527 }
never executed: end of block
0
1528 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QAbstractItemView
2
1529 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QAbstractItemView
6
1530 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QAbstractItemView
6
1531 // add ranges and currentSelection and check through them all-
1532 QList<QItemSelectionRange>::const_iterator it;-
1533 QList<QItemSelectionRange> joined = d->ranges;-
1534 if (d->currentSelection.count())
d->currentSelection.count()Description
TRUEevaluated 825 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 186 times by 4 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemView
186-825
1535 joined += d->currentSelection;
executed 825 times by 10 tests: joined += d->currentSelection;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
825
1536 int rowCount = d->model->rowCount(parent);-
1537 for (int row = 0; row < rowCount; ++row) {
row < rowCountDescription
TRUEevaluated 1093 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
130-1093
1538 for (it = joined.constBegin(); it != joined.constEnd(); ++it) {
it != joined.constEnd()Description
TRUEevaluated 1762 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 881 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
881-1762
1539 if ((*it).contains(row, column, parent)) {
(*it).contains...olumn, parent)Description
TRUEevaluated 216 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1546 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
216-1546
1540 Qt::ItemFlags flags = d->model->index(row, column, parent).flags();-
1541 if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) {-
1542 row = qMax(row, (*it).bottom());-
1543 break;
executed 212 times by 9 tests: break;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
212
1544 }-
1545 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QItemView
4
1546 }
executed 1550 times by 9 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
1550
1547 if (it == joined.constEnd())
it == joined.constEnd()Description
TRUEevaluated 881 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 212 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
212-881
1548 return false;
executed 881 times by 9 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
881
1549 }
executed 212 times by 9 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
212
1550 return rowCount > 0; // no rows means no selected items
executed 130 times by 6 tests: return rowCount > 0;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
130
1551}-
1552-
1553/*!-
1554 Returns \c true if there are any items selected in the \a row with the given-
1555 \a parent.-
1556*/-
1557bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &parent) const-
1558{-
1559 Q_D(const QItemSelectionModel);-
1560 if (!d->model)
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 1349 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
0-1349
1561 return false;
never executed: return false;
0
1562 if (parent.isValid() && d->model != parent.model())
parent.isValid()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 1346 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
d->model != parent.model()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
0-1346
1563 return false;
never executed: return false;
0
1564-
1565 QItemSelection sel = d->ranges;-
1566 sel.merge(d->currentSelection, d->currentCommand);-
1567 for (int i = 0; i < sel.count(); ++i) {
i < sel.count()Description
TRUEevaluated 976 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 1075 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
976-1075
1568 QItemSelectionRange range = sel.at(i);-
1569 if (range.parent() != parent)
range.parent() != parentDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
FALSEevaluated 973 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
3-973
1570 return false;
executed 3 times by 1 test: return false;
Executed by:
  • tst_QItemSelectionModel
3
1571 int top = range.top();-
1572 int bottom = range.bottom();-
1573 int left = range.left();-
1574 int right = range.right();-
1575 if (top <= row && bottom >= row) {
top <= rowDescription
TRUEevaluated 673 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 300 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
bottom >= rowDescription
TRUEevaluated 301 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 372 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
300-673
1576 for (int j = left; j <= right; j++) {
j <= rightDescription
TRUEevaluated 317 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QItemView
30-317
1577 const Qt::ItemFlags flags = d->model->index(row, j, parent).flags();-
1578 if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))-
1579 return true;
executed 271 times by 5 tests: return true;
Executed by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
271
1580 }
executed 46 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QItemView
46
1581 }
executed 30 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QItemView
30
1582 }
executed 702 times by 4 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
702
1583-
1584 return false;
executed 1075 times by 8 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
1075
1585}-
1586-
1587/*!-
1588 Returns \c true if there are any items selected in the \a column with the given-
1589 \a parent.-
1590*/-
1591bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelIndex &parent) const-
1592{-
1593 Q_D(const QItemSelectionModel);-
1594 if (!d->model)
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 682 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
0-682
1595 return false;
never executed: return false;
0
1596 if (parent.isValid() && d->model != parent.model())
parent.isValid()Description
TRUEnever evaluated
FALSEevaluated 682 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
d->model != parent.model()Description
TRUEnever evaluated
FALSEnever evaluated
0-682
1597 return false;
never executed: return false;
0
1598-
1599 QItemSelection sel = d->ranges;-
1600 sel.merge(d->currentSelection, d->currentCommand);-
1601 for (int i = 0; i < sel.count(); ++i) {
i < sel.count()Description
TRUEevaluated 396 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 455 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
396-455
1602 int left = sel.at(i).left();-
1603 int right = sel.at(i).right();-
1604 int top = sel.at(i).top();-
1605 int bottom = sel.at(i).bottom();-
1606 if (left <= column && right >= column) {
left <= columnDescription
TRUEevaluated 337 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 59 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
right >= columnDescription
TRUEevaluated 233 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 104 times by 4 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
59-337
1607 for (int j = top; j <= bottom; j++) {
j <= bottomDescription
TRUEevaluated 245 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QItemView
6-245
1608 const Qt::ItemFlags flags = d->model->index(j, column, parent).flags();-
1609 if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))-
1610 return true;
executed 227 times by 5 tests: return true;
Executed by:
  • tst_QAbstractItemView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
227
1611 }
executed 18 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QItemView
18
1612 }
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QItemView
6
1613 }
executed 169 times by 4 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
169
1614-
1615 return false;
executed 455 times by 8 tests: return false;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStyleSheetStyle
  • tst_QTableView
455
1616}-
1617-
1618/*!-
1619 \since 4.2-
1620-
1621 Returns \c true if the selection model contains any selection ranges;-
1622 otherwise returns \c false.-
1623*/-
1624bool QItemSelectionModel::hasSelection() const-
1625{-
1626 Q_D(const QItemSelectionModel);-
1627 if (d->currentCommand & (Toggle | Deselect)) {
d->currentComm...le | Deselect)Description
TRUEevaluated 64 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 1121 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
64-1121
1628 QItemSelection sel = d->ranges;-
1629 sel.merge(d->currentSelection, d->currentCommand);-
1630 return !sel.isEmpty();
executed 64 times by 6 tests: return !sel.isEmpty();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
64
1631 } else {-
1632 return !(d->ranges.isEmpty() && d->currentSelection.isEmpty());
executed 1121 times by 17 tests: return !(d->ranges.isEmpty() && d->currentSelection.isEmpty());
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1121
1633 }-
1634}-
1635-
1636/*!-
1637 Returns a list of all selected model item indexes. The list contains no-
1638 duplicates, and is not sorted.-
1639*/-
1640QModelIndexList QItemSelectionModel::selectedIndexes() const-
1641{-
1642 Q_D(const QItemSelectionModel);-
1643 QItemSelection selected = d->ranges;-
1644 selected.merge(d->currentSelection, d->currentCommand);-
1645 return selected.indexes();
executed 588 times by 15 tests: return selected.indexes();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
588
1646}-
1647-
1648/*!-
1649 \since 4.2-
1650 Returns the indexes in the given \a column for the rows where all columns are selected.-
1651-
1652 \sa selectedIndexes(), selectedColumns()-
1653*/-
1654-
1655QModelIndexList QItemSelectionModel::selectedRows(int column) const-
1656{-
1657 QModelIndexList indexes;-
1658 //the QSet contains pairs of parent modelIndex-
1659 //and row number-
1660 QSet< QPair<QModelIndex, int> > rowsSeen;-
1661-
1662 const QItemSelection ranges = selection();-
1663 for (int i = 0; i < ranges.count(); ++i) {
i < ranges.count()Description
TRUEevaluated 866 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1145 times by 9 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
866-1145
1664 const QItemSelectionRange &range = ranges.at(i);-
1665 QModelIndex parent = range.parent();-
1666 for (int row = range.top(); row <= range.bottom(); row++) {
row <= range.bottom()Description
TRUEevaluated 911 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 866 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
866-911
1667 QPair<QModelIndex, int> rowDef = qMakePair(parent, row);-
1668 if (!rowsSeen.contains(rowDef)) {
!rowsSeen.contains(rowDef)Description
TRUEevaluated 911 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
0-911
1669 rowsSeen << rowDef;-
1670 if (isRowSelected(row, parent)) {
isRowSelected(row, parent)Description
TRUEevaluated 901 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
10-901
1671 indexes.append(model()->index(row, column, parent));-
1672 }
executed 901 times by 6 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
901
1673 }
executed 911 times by 6 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
911
1674 }
executed 911 times by 6 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
911
1675 }
executed 866 times by 6 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
866
1676-
1677 return indexes;
executed 1145 times by 9 tests: return indexes;
Executed by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1145
1678}-
1679-
1680/*!-
1681 \since 4.2-
1682 Returns the indexes in the given \a row for columns where all rows are selected.-
1683-
1684 \sa selectedIndexes(), selectedRows()-
1685*/-
1686-
1687QModelIndexList QItemSelectionModel::selectedColumns(int row) const-
1688{-
1689 QModelIndexList indexes;-
1690 //the QSet contains pairs of parent modelIndex-
1691 //and column number-
1692 QSet< QPair<QModelIndex, int> > columnsSeen;-
1693-
1694 const QItemSelection ranges = selection();-
1695 for (int i = 0; i < ranges.count(); ++i) {
i < ranges.count()Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEevaluated 11 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
11-22
1696 const QItemSelectionRange &range = ranges.at(i);-
1697 QModelIndex parent = range.parent();-
1698 for (int column = range.left(); column <= range.right(); column++) {
column <= range.right()Description
TRUEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QTableView
22-59
1699 QPair<QModelIndex, int> columnDef = qMakePair(parent, column);-
1700 if (!columnsSeen.contains(columnDef)) {
!columnsSeen.c...ins(columnDef)Description
TRUEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEnever evaluated
0-59
1701 columnsSeen << columnDef;-
1702 if (isColumnSelected(column, parent)) {
isColumnSelect...olumn, parent)Description
TRUEevaluated 29 times by 2 tests
Evaluated by:
  • tst_QItemSelectionModel
  • tst_QTableView
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_QTableView
29-30
1703 indexes.append(model()->index(row, column, parent));-
1704 }
executed 29 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QTableView
29
1705 }
executed 59 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QTableView
59
1706 }
executed 59 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QTableView
59
1707 }
executed 22 times by 2 tests: end of block
Executed by:
  • tst_QItemSelectionModel
  • tst_QTableView
22
1708-
1709 return indexes;
executed 11 times by 3 tests: return indexes;
Executed by:
  • tst_QAccessibility
  • tst_QItemSelectionModel
  • tst_QTableView
11
1710}-
1711-
1712/*!-
1713 Returns the selection ranges stored in the selection model.-
1714*/-
1715const QItemSelection QItemSelectionModel::selection() const-
1716{-
1717 Q_D(const QItemSelectionModel);-
1718 QItemSelection selected = d->ranges;-
1719 selected.merge(d->currentSelection, d->currentCommand);-
1720 // make sure we have no invalid ranges-
1721 // ### should probably be handled more generic somewhere else-
1722 auto isNotValid = [](const QItemSelectionRange& range) {-
1723 return !range.isValid();
executed 1284 times by 12 tests: return !range.isValid();
Executed by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
1284
1724 };-
1725-
1726 selected.erase(std::remove_if(selected.begin(), selected.end(),-
1727 isNotValid),-
1728 selected.end());-
1729 return selected;
executed 11454 times by 42 tests: return selected;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
11454
1730}-
1731-
1732/*!-
1733 \since 5.5-
1734-
1735 \property QItemSelectionModel::hasSelection-
1736 \internal-
1737*/-
1738/*!-
1739 \since 5.5-
1740-
1741 \property QItemSelectionModel::currentIndex-
1742 \internal-
1743*/-
1744/*!-
1745 \since 5.5-
1746-
1747 \property QItemSelectionModel::selectedIndexes-
1748*/-
1749-
1750/*!-
1751 \since 5.5-
1752-
1753 \property QItemSelectionModel::selection-
1754 \internal-
1755*/-
1756/*!-
1757 \since 5.5-
1758-
1759 \property QItemSelectionModel::model-
1760 \internal-
1761*/-
1762/*!-
1763 \since 5.5-
1764-
1765 Returns the item model operated on by the selection model.-
1766*/-
1767QAbstractItemModel *QItemSelectionModel::model()-
1768{-
1769 return d_func()->model;
executed 12802 times by 42 tests: return d_func()->model;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
12802
1770}-
1771-
1772/*!-
1773 Returns the item model operated on by the selection model.-
1774*/-
1775const QAbstractItemModel *QItemSelectionModel::model() const-
1776{-
1777 return d_func()->model;
executed 930 times by 6 tests: return d_func()->model;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
930
1778}-
1779-
1780/*!-
1781 \since 5.5-
1782-
1783 Sets the model to \a model. The modelChanged() signal will be emitted.-
1784-
1785 \sa model(), modelChanged()-
1786*/-
1787void QItemSelectionModel::setModel(QAbstractItemModel *model)-
1788{-
1789 Q_D(QItemSelectionModel);-
1790 if (d->model == model)
d->model == modelDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QItemSelectionModel
0-2
1791 return;
never executed: return;
0
1792-
1793 d->initModel(model);-
1794 emit modelChanged(model);-
1795}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QItemSelectionModel
2
1796-
1797/*!-
1798 Compares the two selections \a newSelection and \a oldSelection-
1799 and emits selectionChanged() with the deselected and selected items.-
1800*/-
1801void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection,-
1802 const QItemSelection &oldSelection)-
1803{-
1804 // if both selections are empty or equal we return-
1805 if ((oldSelection.isEmpty() && newSelection.isEmpty()) ||
oldSelection.isEmpty()Description
TRUEevaluated 2621 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
FALSEevaluated 4679 times by 26 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • ...
newSelection.isEmpty()Description
TRUEevaluated 636 times by 24 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFontDialog
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 1985 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
636-4679
1806 oldSelection == newSelection)
oldSelection == newSelectionDescription
TRUEevaluated 1043 times by 22 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 5621 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
1043-5621
1807 return;
executed 1679 times by 26 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
1679
1808-
1809 // if either selection is empty we do not need to compare-
1810 if (oldSelection.isEmpty() || newSelection.isEmpty()) {
oldSelection.isEmpty()Description
TRUEevaluated 1985 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
FALSEevaluated 3636 times by 25 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
newSelection.isEmpty()Description
TRUEevaluated 1248 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 2388 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
1248-3636
1811 emit selectionChanged(newSelection, oldSelection);-
1812 return;
executed 3233 times by 27 tests: return;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • ...
3233
1813 }-
1814-
1815 QItemSelection deselected = oldSelection;-
1816 QItemSelection selected = newSelection;-
1817-
1818 // remove equal ranges-
1819 bool advance;-
1820 for (int o = 0; o < deselected.count(); ++o) {
o < deselected.count()Description
TRUEevaluated 2550 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 2388 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2388-2550
1821 advance = true;-
1822 for (int s = 0; s < selected.count() && o < deselected.count();) {
s < selected.count()Description
TRUEevaluated 3478 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 2338 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
o < deselected.count()Description
TRUEevaluated 3266 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 212 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
212-3478
1823 if (deselected.at(o) == selected.at(s)) {
deselected.at(...selected.at(s)Description
TRUEevaluated 717 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 2549 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
717-2549
1824 deselected.removeAt(o);-
1825 selected.removeAt(s);-
1826 advance = false;-
1827 } else {
executed 717 times by 14 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
717
1828 ++s;-
1829 }
executed 2549 times by 17 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
2549
1830 }-
1831 if (advance)
advanceDescription
TRUEevaluated 2264 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 286 times by 14 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
286-2264
1832 ++o;
executed 2264 times by 17 tests: ++o;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
2264
1833 }
executed 2550 times by 19 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2550
1834-
1835 // find intersections-
1836 QItemSelection intersections;-
1837 for (int o = 0; o < deselected.count(); ++o) {
o < deselected.count()Description
TRUEevaluated 2458 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2388 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2388-2458
1838 for (int s = 0; s < selected.count(); ++s) {
s < selected.count()Description
TRUEevaluated 2680 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2458 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
2458-2680
1839 if (deselected.at(o).intersects(selected.at(s)))
deselected.at(...elected.at(s))Description
TRUEevaluated 252 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 2428 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
252-2428
1840 intersections.append(deselected.at(o).intersected(selected.at(s)));
executed 252 times by 10 tests: intersections.append(deselected.at(o).intersected(selected.at(s)));
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
252
1841 }
executed 2680 times by 17 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
2680
1842 }
executed 2458 times by 17 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
2458
1843-
1844 // compare remaining ranges with intersections and split them to find deselected and selected-
1845 for (int i = 0; i < intersections.count(); ++i) {
i < intersections.count()Description
TRUEevaluated 252 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 2388 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
252-2388
1846 // split deselected-
1847 for (int o = 0; o < deselected.count();) {
o < deselected.count()Description
TRUEevaluated 655 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 252 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
252-655
1848 if (deselected.at(o).intersects(intersections.at(i))) {
deselected.at(...ections.at(i))Description
TRUEevaluated 252 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 403 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
252-403
1849 QItemSelection::split(deselected.at(o), intersections.at(i), &deselected);-
1850 deselected.removeAt(o);-
1851 } else {
executed 252 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
252
1852 ++o;-
1853 }
executed 403 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
403
1854 }-
1855 // split selected-
1856 for (int s = 0; s < selected.count();) {
s < selected.count()Description
TRUEevaluated 639 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 252 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
252-639
1857 if (selected.at(s).intersects(intersections.at(i))) {
selected.at(s)...ections.at(i))Description
TRUEevaluated 262 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 377 times by 7 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
262-377
1858 QItemSelection::split(selected.at(s), intersections.at(i), &selected);-
1859 selected.removeAt(s);-
1860 } else {
executed 262 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
262
1861 ++s;-
1862 }
executed 377 times by 7 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
377
1863 }-
1864 }
executed 252 times by 10 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QTableView
  • tst_QTreeWidget
252
1865-
1866 if (!selected.isEmpty() || !deselected.isEmpty())
!selected.isEmpty()Description
TRUEevaluated 2293 times by 19 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEevaluated 95 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
!deselected.isEmpty()Description
TRUEevaluated 85 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QTableView
10-2293
1867 emit selectionChanged(selected, deselected);
executed 2378 times by 19 tests: selectionChanged(selected, deselected);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2378
1868}
executed 2388 times by 19 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
2388
1869-
1870#ifndef QT_NO_DEBUG_STREAM-
1871QDebug operator<<(QDebug dbg, const QItemSelectionRange &range)-
1872{-
1873 QDebugStateSaver saver(dbg);-
1874 dbg.nospace() << "QItemSelectionRange(" << range.topLeft()-
1875 << ',' << range.bottomRight() << ')';-
1876 return dbg;
never executed: return dbg;
0
1877}-
1878#endif-
1879-
1880QT_END_NAMESPACE-
1881-
1882#include "moc_qitemselectionmodel.cpp"-
1883-
1884#endif // QT_NO_ITEMVIEWS-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9