OpenCoverage

qabstractitemmodel.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/itemmodels/qabstractitemmodel.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 QtCore 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 "qabstractitemmodel.h"-
41#include <private/qabstractitemmodel_p.h>-
42#include <qdatastream.h>-
43#include <qstringlist.h>-
44#include <qsize.h>-
45#include <qmimedata.h>-
46#include <qdebug.h>-
47#include <qvector.h>-
48#include <qstack.h>-
49#include <qbitarray.h>-
50-
51#include <limits.h>-
52-
53QT_BEGIN_NAMESPACE-
54-
55QPersistentModelIndexData *QPersistentModelIndexData::create(const QModelIndex &index)-
56{-
57 Q_ASSERT(index.isValid()); // we will _never_ insert an invalid index in the list-
58 QPersistentModelIndexData *d = 0;-
59 QAbstractItemModel *model = const_cast<QAbstractItemModel *>(index.model());-
60 QHash<QModelIndex, QPersistentModelIndexData *> &indexes = model->d_func()->persistent.indexes;-
61 const auto it = indexes.constFind(index);-
62 if (it != indexes.cend()) {
it != indexes.cend()Description
TRUEevaluated 77648 times by 34 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
FALSEevaluated 26745 times by 41 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
26745-77648
63 d = (*it);-
64 } else {
executed 77648 times by 34 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
77648
65 d = new QPersistentModelIndexData(index);-
66 indexes.insert(index, d);-
67 }
executed 26745 times by 41 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
26745
68 Q_ASSERT(d);-
69 return d;
executed 104393 times by 41 tests: return d;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
104393
70}-
71-
72void QPersistentModelIndexData::destroy(QPersistentModelIndexData *data)-
73{-
74 Q_ASSERT(data);-
75 Q_ASSERT(data->ref.load() == 0);-
76 QAbstractItemModel *model = const_cast<QAbstractItemModel *>(data->model);-
77 // a valid persistent model index with a null model pointer can only happen if the model was destroyed-
78 if (model) {
modelDescription
TRUEevaluated 21136 times by 38 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 5595 times by 39 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • ...
5595-21136
79 QAbstractItemModelPrivate *p = model->d_func();-
80 Q_ASSERT(p);-
81 p->removePersistentIndexData(data);-
82 }
executed 21136 times by 38 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
21136
83 delete data;-
84}
executed 26731 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
26731
85-
86/*!-
87 \class QPersistentModelIndex-
88 \inmodule QtCore-
89 \ingroup shared-
90-
91 \brief The QPersistentModelIndex class is used to locate data in a data model.-
92-
93 \ingroup model-view-
94-
95 A QPersistentModelIndex is a model index that can be stored by an-
96 application, and later used to access information in a model.-
97 Unlike the QModelIndex class, it is safe to store a-
98 QPersistentModelIndex since the model will ensure that references-
99 to items will continue to be valid as long as they can be accessed-
100 by the model.-
101-
102 It is good practice to check that persistent model indexes are valid-
103 before using them.-
104-
105 \sa {Model/View Programming}, QModelIndex, QAbstractItemModel-
106*/-
107-
108/*!-
109 \fn QPersistentModelIndex::QPersistentModelIndex(QPersistentModelIndex &&other)-
110-
111 Move-constructs a QPersistentModelIndex instance, making it point at the same-
112 object that \a other was pointing to.-
113-
114 \since 5.2-
115*/-
116-
117/*!-
118 \fn QPersistentModelIndex &QPersistentModelIndex::operator=(QPersistentModelIndex &&other)-
119-
120 Move-assigns \a other to this QPersistentModelIndex instance.-
121-
122 \since 5.2-
123*/-
124-
125-
126/*!-
127 \fn QPersistentModelIndex::QPersistentModelIndex()-
128-
129 \internal-
130*/-
131-
132QPersistentModelIndex::QPersistentModelIndex()-
133 : d(0)-
134{-
135}
executed 38001 times by 49 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • ...
38001
136-
137/*!-
138 \fn QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other)-
139-
140 Creates a new QPersistentModelIndex that is a copy of the \a other persistent-
141 model index.-
142*/-
143-
144QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other)-
145 : d(other.d)-
146{-
147 if (d) d->ref.ref();
executed 94049 times by 34 tests: d->ref.ref();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
dDescription
TRUEevaluated 94049 times by 34 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
FALSEevaluated 1776 times by 36 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QMetaType
  • ...
1776-94049
148}
executed 95825 times by 37 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QMetaType
  • ...
95825
149-
150/*!-
151 Creates a new QPersistentModelIndex that is a copy of the model \a index.-
152*/-
153-
154QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index)-
155 : d(0)-
156{-
157 if (index.isValid()) {
index.isValid()Description
TRUEevaluated 96651 times by 41 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
FALSEevaluated 615 times by 23 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItem
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QVariant
615-96651
158 d = QPersistentModelIndexData::create(index);-
159 d->ref.ref();-
160 }
executed 96651 times by 41 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
96651
161}
executed 97266 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
97266
162-
163/*!-
164 \fn QPersistentModelIndex::~QPersistentModelIndex()-
165-
166 \internal-
167*/-
168-
169QPersistentModelIndex::~QPersistentModelIndex()-
170{-
171 if (d && !d->ref.deref()) {
dDescription
TRUEevaluated 193749 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
FALSEevaluated 35186 times by 52 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • ...
!d->ref.deref()Description
TRUEevaluated 18743 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
FALSEevaluated 175006 times by 36 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
18743-193749
172 QPersistentModelIndexData::destroy(d);-
173 d = 0;-
174 }
executed 18743 times by 43 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
18743
175}
executed 228935 times by 53 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • ...
228935
176-
177/*!-
178 Returns \c{true} if this persistent model index is equal to the \a other-
179 persistent model index; otherwise returns \c{false}.-
180-
181 All values in the persistent model index are used when comparing-
182 with another persistent model index.-
183*/-
184-
185bool QPersistentModelIndex::operator==(const QPersistentModelIndex &other) const-
186{-
187 if (d && other.d)
dDescription
TRUEevaluated 40738 times by 27 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • 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
  • ...
FALSEevaluated 708 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMetaType
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
other.dDescription
TRUEevaluated 39163 times by 27 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • 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
  • ...
FALSEevaluated 1575 times by 6 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QListView
  • tst_QTreeView
  • tst_QTreeWidget
708-40738
188 return d->index == other.d->index;
executed 39163 times by 27 tests: return d->index == other.d->index;
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • 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
  • ...
39163
189 return d == other.d;
executed 2283 times by 15 tests: return d == other.d;
Executed by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMetaType
  • tst_QSqlQueryModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
2283
190}-
191-
192/*!-
193 \since 4.1-
194-
195 Returns \c{true} if this persistent model index is smaller than the \a other-
196 persistent model index; otherwise returns \c{false}.-
197-
198 All values in the persistent model index are used when comparing-
199 with another persistent model index.-
200*/-
201-
202bool QPersistentModelIndex::operator<(const QPersistentModelIndex &other) const-
203{-
204 if (d && other.d)
dDescription
TRUEevaluated 1934 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEnever evaluated
other.dDescription
TRUEevaluated 1934 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
FALSEnever evaluated
0-1934
205 return d->index < other.d->index;
executed 1934 times by 8 tests: return d->index < other.d->index;
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeWidget
1934
206-
207 return d < other.d;
never executed: return d < other.d;
0
208}-
209-
210/*!-
211 \fn bool QPersistentModelIndex::operator!=(const QPersistentModelIndex &other) const-
212 \since 4.2-
213-
214 Returns \c{true} if this persistent model index is not equal to the \a-
215 other persistent model index; otherwise returns \c{false}.-
216*/-
217-
218/*!-
219 Sets the persistent model index to refer to the same item in a model-
220 as the \a other persistent model index.-
221*/-
222-
223QPersistentModelIndex &QPersistentModelIndex::operator=(const QPersistentModelIndex &other)-
224{-
225 if (d == other.d)
d == other.dDescription
TRUEevaluated 152 times by 10 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemView
  • tst_QListView
  • tst_QSidebar
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 14678 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • 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
152-14678
226 return *this;
executed 152 times by 10 tests: return *this;
Executed by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemView
  • tst_QListView
  • tst_QSidebar
  • tst_QTreeView
  • tst_QTreeWidget
152
227 if (d && !d->ref.deref())
dDescription
TRUEevaluated 14386 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 292 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemDelegate
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
!d->ref.deref()Description
TRUEevaluated 5918 times by 8 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QItemView
  • tst_QListView
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 8468 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
292-14386
228 QPersistentModelIndexData::destroy(d);
executed 5918 times by 8 tests: QPersistentModelIndexData::destroy(d);
Executed by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QItemView
  • tst_QListView
  • tst_QTableWidget
  • tst_QTreeView
5918
229 d = other.d;-
230 if (d) d->ref.ref();
executed 14655 times by 21 tests: d->ref.ref();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • 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
dDescription
TRUEevaluated 14655 times by 21 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • 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 23 times by 5 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QFileDialog2
  • tst_QListView
  • tst_QTreeView
  • tst_QTreeWidget
23-14655
231 return *this;
executed 14678 times by 21 tests: return *this;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • 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
14678
232}-
233/*!-
234 \fn void QPersistentModelIndex::swap(QPersistentModelIndex &other)-
235 \since 5.0-
236-
237 Swaps this persistent modelindex with \a other. This function is-
238 very fast and never fails.-
239*/-
240-
241/*!-
242 Sets the persistent model index to refer to the same item in a model-
243 as the \a other model index.-
244*/-
245-
246QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other)-
247{-
248 if (d && !d->ref.deref())
dDescription
TRUEevaluated 4936 times by 29 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • 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_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • ...
FALSEevaluated 22858 times by 44 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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
  • ...
!d->ref.deref()Description
TRUEevaluated 2070 times by 27 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
FALSEevaluated 2866 times by 24 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • 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
2070-22858
249 QPersistentModelIndexData::destroy(d);
executed 2070 times by 27 tests: QPersistentModelIndexData::destroy(d);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • ...
2070
250 if (other.isValid()) {
other.isValid()Description
TRUEevaluated 7742 times by 32 tests
Evaluated by:
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
FALSEevaluated 20052 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
  • ...
7742-20052
251 d = QPersistentModelIndexData::create(other);-
252 if (d) d->ref.ref();
executed 7742 times by 32 tests: d->ref.ref();
Executed by:
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
dDescription
TRUEevaluated 7742 times by 32 tests
Evaluated by:
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
FALSEnever evaluated
0-7742
253 } else {
executed 7742 times by 32 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
7742
254 d = 0;-
255 }
executed 20052 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
  • ...
20052
256 return *this;
executed 27794 times by 44 tests: return *this;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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
  • ...
27794
257}-
258-
259/*!-
260 \fn QPersistentModelIndex::operator const QModelIndex&() const-
261-
262 Cast operator that returns a const QModelIndex&.-
263*/-
264-
265QPersistentModelIndex::operator const QModelIndex&() const-
266{-
267 static const QModelIndex invalid;-
268 if (d)
dDescription
TRUEevaluated 114022 times by 40 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
FALSEevaluated 530197 times by 48 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • tst_QLineEdit
  • ...
114022-530197
269 return d->index;
executed 114022 times by 40 tests: return d->index;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • ...
114022
270 return invalid;
executed 530197 times by 48 tests: return invalid;
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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • tst_QLineEdit
  • ...
530197
271}-
272-
273/*!-
274 \fn bool QPersistentModelIndex::operator==(const QModelIndex &other) const-
275-
276 Returns \c{true} if this persistent model index refers to the same location as-
277 the \a other model index; otherwise returns \c{false}.-
278-
279 All values in the persistent model index are used when comparing with-
280 another model index.-
281*/-
282-
283bool QPersistentModelIndex::operator==(const QModelIndex &other) const-
284{-
285 if (d)
dDescription
TRUEevaluated 809 times by 9 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeView
FALSEevaluated 1850 times by 22 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QLayout
  • tst_QPrinter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QWidgetAction
  • tst_QWizard
  • tst_languageChange
  • tst_qapplication - unknown status
809-1850
286 return d->index == other;
executed 809 times by 9 tests: return d->index == other;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QColumnView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QTreeView
809
287 return !other.isValid();
executed 1850 times by 22 tests: return !other.isValid();
Executed by:
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QLayout
  • tst_QPrinter
  • tst_QStyle
  • tst_QStyleSheetStyle
  • tst_QWidgetAction
  • tst_QWizard
  • tst_languageChange
  • tst_qapplication - unknown status
1850
288}-
289-
290/*!-
291 \fn bool QPersistentModelIndex::operator!=(const QModelIndex &other) const-
292-
293 Returns \c{true} if this persistent model index does not refer to the same-
294 location as the \a other model index; otherwise returns \c{false}.-
295*/-
296-
297bool QPersistentModelIndex::operator!=(const QModelIndex &other) const-
298{-
299 if (d)
dDescription
TRUEevaluated 189 times by 3 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QAbstractItemView
2-189
300 return d->index != other;
executed 189 times by 3 tests: return d->index != other;
Executed by:
  • tst_QAbstractItemView
  • tst_QItemView
  • tst_QTableView
189
301 return other.isValid();
executed 2 times by 1 test: return other.isValid();
Executed by:
  • tst_QAbstractItemView
2
302}-
303-
304/*!-
305 \fn int QPersistentModelIndex::row() const-
306-
307 Returns the row this persistent model index refers to.-
308*/-
309-
310int QPersistentModelIndex::row() const-
311{-
312 if (d)
dDescription
TRUEevaluated 257311 times by 39 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 3978 times by 36 tests
Evaluated by:
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • ...
3978-257311
313 return d->index.row();
executed 257311 times by 39 tests: return d->index.row();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
257311
314 return -1;
executed 3978 times by 36 tests: return -1;
Executed by:
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • ...
3978
315}-
316-
317/*!-
318 \fn int QPersistentModelIndex::column() const-
319-
320 Returns the column this persistent model index refers to.-
321*/-
322-
323int QPersistentModelIndex::column() const-
324{-
325 if (d)
dDescription
TRUEevaluated 193402 times by 34 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
FALSEevaluated 1944 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
  • ...
1944-193402
326 return d->index.column();
executed 193402 times by 34 tests: return d->index.column();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSidebar
  • ...
193402
327 return -1;
executed 1944 times by 28 tests: return -1;
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
  • ...
1944
328}-
329-
330/*!-
331 \fn void *QPersistentModelIndex::internalPointer() const-
332-
333 \internal-
334-
335 Returns a \c{void} \c{*} pointer used by the model to associate the index with-
336 the internal data structure.-
337*/-
338-
339void *QPersistentModelIndex::internalPointer() const-
340{-
341 if (d)
dDescription
TRUEevaluated 108 times by 2 tests
Evaluated by:
  • tst_QListWidget
  • tst_QTreeWidget
FALSEnever evaluated
0-108
342 return d->index.internalPointer();
executed 108 times by 2 tests: return d->index.internalPointer();
Executed by:
  • tst_QListWidget
  • tst_QTreeWidget
108
343 return 0;
never executed: return 0;
0
344}-
345-
346/*!-
347 \fn quintptr QPersistentModelIndex::internalId() const-
348-
349 \internal-
350-
351 Returns a \c{quintptr} used by the model to associate the index with-
352 the internal data structure.-
353*/-
354-
355quintptr QPersistentModelIndex::internalId() const-
356{-
357 if (d)
dDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEnever evaluated
0-4
358 return d->index.internalId();
executed 4 times by 1 test: return d->index.internalId();
Executed by:
  • tst_QAbstractItemModel
4
359 return 0;
never executed: return 0;
0
360}-
361-
362/*!-
363 Returns the parent QModelIndex for this persistent index, or an invalid-
364 QModelIndex if it has no parent.-
365-
366 \sa child(), sibling(), model()-
367*/-
368QModelIndex QPersistentModelIndex::parent() const-
369{-
370 if (d)
dDescription
TRUEevaluated 196283 times by 30 tests
Evaluated by:
  • tst_ModelTest
  • 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
  • ...
FALSEevaluated 3363 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
3363-196283
371 return d->index.parent();
executed 196283 times by 30 tests: return d->index.parent();
Executed by:
  • tst_ModelTest
  • 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
  • ...
196283
372 return QModelIndex();
executed 3363 times by 12 tests: return QModelIndex();
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
3363
373}-
374-
375/*!-
376 Returns the sibling at \a row and \a column or an invalid QModelIndex if-
377 there is no sibling at this position.-
378-
379 \sa parent(), child()-
380*/-
381-
382QModelIndex QPersistentModelIndex::sibling(int row, int column) const-
383{-
384 if (d)
dDescription
TRUEevaluated 13 times by 2 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
FALSEnever evaluated
0-13
385 return d->index.sibling(row, column);
executed 13 times by 2 tests: return d->index.sibling(row, column);
Executed by:
  • tst_QAbstractItemView
  • tst_QItemSelectionModel
13
386 return QModelIndex();
never executed: return QModelIndex();
0
387}-
388-
389/*!-
390 Returns the child of the model index that is stored in the given \a row-
391 and \a column.-
392-
393 \sa parent(), sibling()-
394*/-
395-
396QModelIndex QPersistentModelIndex::child(int row, int column) const-
397{-
398 if (d)
dDescription
TRUEnever evaluated
FALSEnever evaluated
0
399 return d->index.child(row, column);
never executed: return d->index.child(row, column);
0
400 return QModelIndex();
never executed: return QModelIndex();
0
401}-
402-
403/*!-
404 Returns the data for the given \a role for the item referred to by the-
405 index.-
406-
407 \sa Qt::ItemDataRole, QAbstractItemModel::setData()-
408*/-
409QVariant QPersistentModelIndex::data(int role) const-
410{-
411 if (d)
dDescription
TRUEevaluated 232 times by 6 tests
Evaluated by:
  • tst_QComboBox
  • tst_QDataWidgetMapper
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QPrinter
  • tst_QTableWidget
FALSEnever evaluated
0-232
412 return d->index.data(role);
executed 232 times by 6 tests: return d->index.data(role);
Executed by:
  • tst_QComboBox
  • tst_QDataWidgetMapper
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QPrinter
  • tst_QTableWidget
232
413 return QVariant();
never executed: return QVariant();
0
414}-
415-
416/*!-
417 \since 4.2-
418-
419 Returns the flags for the item referred to by the index.-
420*/-
421Qt::ItemFlags QPersistentModelIndex::flags() const-
422{-
423 if (d)
dDescription
TRUEevaluated 841 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
0-841
424 return d->index.flags();
executed 841 times by 3 tests: return d->index.flags();
Executed by:
  • tst_QAccessibility
  • tst_QTreeView
  • tst_QTreeWidget
841
425 return 0;
never executed: return 0;
0
426}-
427-
428/*!-
429 Returns the model that the index belongs to.-
430*/-
431const QAbstractItemModel *QPersistentModelIndex::model() const-
432{-
433 if (d)
dDescription
TRUEevaluated 32910 times by 23 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_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEnever evaluated
0-32910
434 return d->index.model();
executed 32910 times by 23 tests: return d->index.model();
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_QItemDelegate
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QListView
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
32910
435 return 0;
never executed: return 0;
0
436}-
437-
438/*!-
439 \fn bool QPersistentModelIndex::isValid() const-
440-
441 Returns \c{true} if this persistent model index is valid; otherwise returns-
442 \c{false}.-
443-
444 A valid index belongs to a model, and has non-negative row and column-
445 numbers.-
446-
447 \sa model(), row(), column()-
448*/-
449-
450bool QPersistentModelIndex::isValid() const-
451{-
452 return d && d->index.isValid();
executed 140803 times by 42 tests: return d && d->index.isValid();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • ...
140803
453}-
454-
455#ifndef QT_NO_DEBUG_STREAM-
456QDebug operator<<(QDebug dbg, const QModelIndex &idx)-
457{-
458 QDebugStateSaver saver(dbg);-
459 dbg.nospace() << "QModelIndex(" << idx.row() << ',' << idx.column()-
460 << ',' << idx.internalPointer() << ',' << idx.model() << ')';-
461 return dbg;
executed 15 times by 3 tests: return dbg;
Executed by:
  • tst_ModelTest
  • tst_QAccessibility
  • tst_QVariant
15
462}-
463-
464QDebug operator<<(QDebug dbg, const QPersistentModelIndex &idx)-
465{-
466 if (idx.d)
idx.dDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QVariant
0-1
467 dbg << idx.d->index;
never executed: dbg << idx.d->index;
0
468 else-
469 dbg << QModelIndex();
executed 1 time by 1 test: dbg << QModelIndex();
Executed by:
  • tst_QVariant
1
470 return dbg;
executed 1 time by 1 test: return dbg;
Executed by:
  • tst_QVariant
1
471}-
472#endif-
473-
474class QEmptyItemModel : public QAbstractItemModel-
475{-
476public:-
477 explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {}
executed 45 times by 45 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • ...
45
478 QModelIndex index(int, int, const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); }
executed 56 times by 5 tests: return QModelIndex();
Executed by:
  • tst_QAbstractItemView
  • tst_QColumnView
  • tst_QItemView
  • tst_QListView
  • tst_QTreeView
56
479 QModelIndex parent(const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); }
never executed: return QModelIndex();
0
480 int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; }
executed 1475 times by 23 tests: return 0;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemView
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
1475
481 int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; }
executed 2492 times by 32 tests: return 0;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSplitter
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableView
  • ...
2492
482 bool hasChildren(const QModelIndex &) const Q_DECL_OVERRIDE { return false; }
executed 242 times by 8 tests: return false;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QItemView
  • tst_QSortFilterProxyModel
  • tst_QSplitter
  • tst_QStyleSheetStyle
  • tst_QTreeView
242
483 QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE { return QVariant(); }
executed 1030 times by 2 tests: return QVariant();
Executed by:
  • tst_ModelTest
  • tst_QAbstractProxyModel
1030
484};-
485-
486Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel)
executed 46 times by 46 tests: end of block
Executed by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • tst_qitemmodel - unknown status
  • ...
executed 46 times by 46 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • tst_qitemmodel - unknown status
  • ...
executed 212275 times by 49 tests: return &holder.value;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 46 times by 46 tests
Evaluated by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • tst_qitemmodel - unknown status
  • ...
FALSEnever evaluated
0-212275
487-
488-
489QAbstractItemModelPrivate::QAbstractItemModelPrivate()-
490 : QObjectPrivate(),-
491 supportedDragActions(-1),-
492 roleNames(defaultRoleNames())-
493{-
494}
executed 5394 times by 54 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • ...
5394
495-
496QAbstractItemModelPrivate::~QAbstractItemModelPrivate()-
497{-
498}-
499-
500QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel()-
501{-
502 return qEmptyModel();
executed 212275 times by 49 tests: return qEmptyModel();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • ...
212275
503}-
504-
505void QAbstractItemModelPrivate::invalidatePersistentIndexes()-
506{-
507 for (QPersistentModelIndexData *data : qAsConst(persistent.indexes)) {-
508 data->index = QModelIndex();-
509 data->model = 0;-
510 }
executed 4404 times by 38 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QPrinter
  • ...
4404
511 persistent.indexes.clear();-
512}
executed 14712 times by 98 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • ...
14712
513-
514/*!-
515 \internal-
516 Clean the QPersistentModelIndex relative to the index if there is one.-
517 To be used before an index is invalided-
518*/-
519void QAbstractItemModelPrivate::invalidatePersistentIndex(const QModelIndex &index) {-
520 const auto it = persistent.indexes.constFind(index);-
521 if (it != persistent.indexes.cend()) {
it != persiste...indexes.cend()Description
TRUEevaluated 1130 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_languageChange
FALSEevaluated 3496222 times by 37 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QPrinter
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
1130-3496222
522 QPersistentModelIndexData *data = *it;-
523 persistent.indexes.erase(it);-
524 data->index = QModelIndex();-
525 data->model = 0;-
526 }
executed 1130 times by 11 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_languageChange
1130
527}
executed 3497352 times by 37 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QPrinter
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • ...
3497352
528-
529namespace {-
530 struct DefaultRoleNames : public QHash<int, QByteArray>-
531 {-
532 DefaultRoleNames() {-
533 (*this)[Qt::DisplayRole] = "display";-
534 (*this)[Qt::DecorationRole] = "decoration";-
535 (*this)[Qt::EditRole] = "edit";-
536 (*this)[Qt::ToolTipRole] = "toolTip";-
537 (*this)[Qt::StatusTipRole] = "statusTip";-
538 (*this)[Qt::WhatsThisRole] = "whatsThis";-
539 }
executed 52 times by 52 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • ...
52
540 };-
541}-
542-
543Q_GLOBAL_STATIC(DefaultRoleNames, qDefaultRoleNames)
executed 54 times by 54 tests: end of block
Executed by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgridlayout - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • ...
executed 54 times by 54 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgridlayout - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • ...
executed 5394 times by 54 tests: return &holder.value;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • ...
guard.load() =...c::InitializedDescription
TRUEevaluated 54 times by 54 tests
Evaluated by:
  • tst_languagechange - unknown status
  • tst_modeltest - unknown status
  • tst_qabstractitemmodel - unknown status
  • tst_qabstractitemview - unknown status
  • tst_qabstractproxymodel - unknown status
  • tst_qaccessibility - unknown status
  • tst_qapplication - unknown status
  • tst_qcalendarwidget - unknown status
  • tst_qcolumnview - unknown status
  • tst_qcombobox - unknown status
  • tst_qcompleter - unknown status
  • tst_qdatawidgetmapper - unknown status
  • tst_qdatetimeedit - unknown status
  • tst_qdirmodel - unknown status
  • tst_qfiledialog - unknown status
  • tst_qfiledialog2 - unknown status
  • tst_qfilesystemmodel - unknown status
  • tst_qfontcombobox - unknown status
  • tst_qfontdialog - unknown status
  • tst_qgraphicsproxywidget - unknown status
  • tst_qgridlayout - unknown status
  • tst_qheaderview - unknown status
  • tst_qidentityproxymodel - unknown status
  • tst_qinputdialog - unknown status
  • tst_qitemdelegate - unknown status
  • ...
FALSEnever evaluated
0-5394
544-
545const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()-
546{-
547 return *qDefaultRoleNames();
executed 5394 times by 54 tests: return *qDefaultRoleNames();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • ...
5394
548}-
549-
550-
551static uint typeOfVariant(const QVariant &value)-
552{-
553 //return 0 for integer, 1 for floating point and 2 for other-
554 switch (value.userType()) {-
555 case QVariant::Bool:
never executed: case QVariant::Bool:
0
556 case QVariant::Int:
executed 26 times by 2 tests: case QVariant::Int:
Executed by:
  • tst_QListWidget
  • tst_QTreeWidget
26
557 case QVariant::UInt:
never executed: case QVariant::UInt:
0
558 case QVariant::LongLong:
never executed: case QVariant::LongLong:
0
559 case QVariant::ULongLong:
never executed: case QVariant::ULongLong:
0
560 case QVariant::Char:
never executed: case QVariant::Char:
0
561 case QMetaType::Short:
never executed: case QMetaType::Short:
0
562 case QMetaType::UShort:
never executed: case QMetaType::UShort:
0
563 case QMetaType::UChar:
never executed: case QMetaType::UChar:
0
564 case QMetaType::ULong:
never executed: case QMetaType::ULong:
0
565 case QMetaType::Long:
never executed: case QMetaType::Long:
0
566 return 0;
executed 26 times by 2 tests: return 0;
Executed by:
  • tst_QListWidget
  • tst_QTreeWidget
26
567 case QVariant::Double:
never executed: case QVariant::Double:
0
568 case QMetaType::Float:
never executed: case QMetaType::Float:
0
569 return 1;
never executed: return 1;
0
570 default:
executed 22804 times by 6 tests: default:
Executed by:
  • tst_ModelTest
  • tst_QItemModel
  • tst_QListWidget
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
22804
571 return 2;
executed 22804 times by 6 tests: return 2;
Executed by:
  • tst_ModelTest
  • tst_QItemModel
  • tst_QListWidget
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
22804
572 }-
573}-
574-
575/*!-
576 \internal-
577 Return \c{true} if \a value contains a numerical type.-
578-
579 This function is used by our Q{Tree,Widget,Table}WidgetModel classes to sort.-
580*/-
581bool QAbstractItemModelPrivate::variantLessThan(const QVariant &v1, const QVariant &v2)-
582{-
583 switch(qMax(typeOfVariant(v1), typeOfVariant(v2)))-
584 {-
585 case 0: //integer type
executed 13 times by 2 tests: case 0:
Executed by:
  • tst_QListWidget
  • tst_QTreeWidget
13
586 return v1.toLongLong() < v2.toLongLong();
executed 13 times by 2 tests: return v1.toLongLong() < v2.toLongLong();
Executed by:
  • tst_QListWidget
  • tst_QTreeWidget
13
587 case 1: //floating point
never executed: case 1:
0
588 return v1.toReal() < v2.toReal();
never executed: return v1.toReal() < v2.toReal();
0
589 default:
executed 11402 times by 6 tests: default:
Executed by:
  • tst_ModelTest
  • tst_QItemModel
  • tst_QListWidget
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
11402
590 return v1.toString().localeAwareCompare(v2.toString()) < 0;
executed 11402 times by 6 tests: return v1.toString().localeAwareCompare(v2.toString()) < 0;
Executed by:
  • tst_ModelTest
  • tst_QItemModel
  • tst_QListWidget
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
11402
591 }-
592}-
593-
594void QAbstractItemModelPrivate::removePersistentIndexData(QPersistentModelIndexData *data)-
595{-
596 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 21134 times by 38 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QDirModel
2-21134
597 int removed = persistent.indexes.remove(data->index);-
598 Q_ASSERT_X(removed == 1, "QPersistentModelIndex::~QPersistentModelIndex",-
599 "persistent model indexes corrupted"); //maybe the index was somewhat invalid?-
600 // This assert may happen if the model use changePersistentIndex in a way that could result on two-
601 // QPersistentModelIndex pointing to the same index.-
602 Q_UNUSED(removed);-
603 }
executed 21134 times by 38 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
21134
604 // make sure our optimization still works-
605 for (int i = persistent.moved.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEevaluated 21136 times by 38 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
0-21136
606 int idx = persistent.moved.at(i).indexOf(data);-
607 if (idx >= 0)
idx >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
608 persistent.moved[i].remove(idx);
never executed: persistent.moved[i].remove(idx);
0
609 }
never executed: end of block
0
610 // update the references to invalidated persistent indexes-
611 for (int i = persistent.invalidated.count() - 1; i >= 0; --i) {
i >= 0Description
TRUEnever evaluated
FALSEevaluated 21136 times by 38 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
0-21136
612 int idx = persistent.invalidated.at(i).indexOf(data);-
613 if (idx >= 0)
idx >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
614 persistent.invalidated[i].remove(idx);
never executed: persistent.invalidated[i].remove(idx);
0
615 }
never executed: end of block
0
616-
617}
executed 21136 times by 38 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • 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_QListView
  • tst_QListWidget
  • ...
21136
618-
619void QAbstractItemModelPrivate::rowsAboutToBeInserted(const QModelIndex &parent,-
620 int first, int last)-
621{-
622 Q_Q(QAbstractItemModel);-
623 Q_UNUSED(last);-
624 QVector<QPersistentModelIndexData *> persistent_moved;-
625 if (first < q->rowCount(parent)) {
first < q->rowCount(parent)Description
TRUEevaluated 2726 times by 25 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 119270 times by 43 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • ...
2726-119270
626 for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin();-
627 it != persistent.indexes.constEnd(); ++it) {
it != persiste...xes.constEnd()Description
TRUEevaluated 7852 times by 15 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2726 times by 25 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
2726-7852
628 QPersistentModelIndexData *data = *it;-
629 const QModelIndex &index = data->index;-
630 if (index.row() >= first && index.isValid() && index.parent() == parent) {
index.row() >= firstDescription
TRUEevaluated 6498 times by 15 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 1354 times by 9 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
index.isValid()Description
TRUEevaluated 6498 times by 15 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
index.parent() == parentDescription
TRUEevaluated 6164 times by 12 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 334 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
0-6498
631 persistent_moved.append(data);-
632 }
executed 6164 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeWidget
6164
633 }
executed 7852 times by 15 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
7852
634 }
executed 2726 times by 25 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
2726
635 persistent.moved.push(persistent_moved);-
636}
executed 121996 times by 45 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • ...
121996
637-
638void QAbstractItemModelPrivate::rowsInserted(const QModelIndex &parent,-
639 int first, int last)-
640{-
641 QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop();-
642 int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested-
643 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin();-
644 it != persistent_moved.constEnd(); ++it) {
it != persiste...ved.constEnd()Description
TRUEevaluated 6164 times by 12 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeWidget
FALSEevaluated 121996 times by 45 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • ...
6164-121996
645 QPersistentModelIndexData *data = *it;-
646 QModelIndex old = data->index;-
647 persistent.indexes.erase(persistent.indexes.constFind(old));-
648 data->index = q_func()->index(old.row() + count, old.column(), parent);-
649 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 6164 times by 12 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeWidget
FALSEnever evaluated
0-6164
650 persistent.insertMultiAtEnd(data->index, data);-
651 } else {
executed 6164 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFiledialog
  • tst_QItemSelectionModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeWidget
6164
652 qWarning() << "QAbstractItemModel::endInsertRows: Invalid index (" << old.row() + count << ',' << old.column() << ") in model" << q_func();-
653 }
never executed: end of block
0
654 }-
655}
executed 121996 times by 45 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • ...
121996
656-
657void QAbstractItemModelPrivate::itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)-
658{-
659 QVector<QPersistentModelIndexData *> persistent_moved_explicitly;-
660 QVector<QPersistentModelIndexData *> persistent_moved_in_source;-
661 QVector<QPersistentModelIndexData *> persistent_moved_in_destination;-
662-
663 QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it;-
664 const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator begin = persistent.indexes.constBegin();-
665 const QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator end = persistent.indexes.constEnd();-
666-
667 const bool sameParent = (srcParent == destinationParent);-
668 const bool movingUp = (srcFirst > destinationChild);-
669-
670 for ( it = begin; it != end; ++it) {
it != endDescription
TRUEevaluated 2617 times by 3 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 72 times by 5 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
72-2617
671 QPersistentModelIndexData *data = *it;-
672 const QModelIndex &index = data->index;-
673 const QModelIndex &parent = index.parent();-
674 const bool isSourceIndex = (parent == srcParent);-
675 const bool isDestinationIndex = (parent == destinationParent);-
676-
677 int childPosition;-
678 if (orientation == Qt::Vertical)
orientation == Qt::VerticalDescription
TRUEevaluated 2617 times by 3 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
FALSEnever evaluated
0-2617
679 childPosition = index.row();
executed 2617 times by 3 tests: childPosition = index.row();
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
2617
680 else-
681 childPosition = index.column();
never executed: childPosition = index.column();
0
682-
683 if (!index.isValid() || !(isSourceIndex || isDestinationIndex ) )
!index.isValid()Description
TRUEnever evaluated
FALSEevaluated 2617 times by 3 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
isSourceIndexDescription
TRUEevaluated 1312 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEevaluated 1305 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
isDestinationIndexDescription
TRUEevaluated 823 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 482 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
0-2617
684 continue;
executed 482 times by 2 tests: continue;
Executed by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
482
685-
686 if (!sameParent && isDestinationIndex) {
!sameParentDescription
TRUEevaluated 1655 times by 3 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 480 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
isDestinationIndexDescription
TRUEevaluated 823 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 832 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
480-1655
687 if (childPosition >= destinationChild)
childPosition ...stinationChildDescription
TRUEevaluated 376 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 447 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
376-447
688 persistent_moved_in_destination.append(data);
executed 376 times by 1 test: persistent_moved_in_destination.append(data);
Executed by:
  • tst_QAbstractItemModel
376
689 continue;
executed 823 times by 2 tests: continue;
Executed by:
  • tst_QAbstractItemModel
  • tst_QSortFilterProxyModel
823
690 }-
691-
692 if (sameParent && movingUp && childPosition < destinationChild)
sameParentDescription
TRUEevaluated 480 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 832 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
movingUpDescription
TRUEevaluated 160 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 320 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
childPosition ...stinationChildDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
28-832
693 continue;
executed 28 times by 1 test: continue;
Executed by:
  • tst_QAbstractItemModel
28
694-
695 if (sameParent && !movingUp && childPosition < srcFirst )
sameParentDescription
TRUEevaluated 452 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 832 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
!movingUpDescription
TRUEevaluated 320 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
childPosition < srcFirstDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 272 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
48-832
696 continue;
executed 48 times by 1 test: continue;
Executed by:
  • tst_QAbstractItemModel
48
697-
698 if (!sameParent && childPosition < srcFirst)
!sameParentDescription
TRUEevaluated 832 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEevaluated 404 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
childPosition < srcFirstDescription
TRUEevaluated 386 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 446 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
386-832
699 continue;
executed 386 times by 1 test: continue;
Executed by:
  • tst_QAbstractItemModel
386
700-
701 if (sameParent && (childPosition > srcLast) && (childPosition >= destinationChild ))
sameParentDescription
TRUEevaluated 404 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 446 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
(childPosition > srcLast)Description
TRUEevaluated 192 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 212 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
(childPosition...inationChild )Description
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 144 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
48-446
702 continue;
executed 48 times by 1 test: continue;
Executed by:
  • tst_QAbstractItemModel
48
703-
704 if ((childPosition <= srcLast) && (childPosition >= srcFirst)) {
(childPosition <= srcLast)Description
TRUEevaluated 463 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEevaluated 339 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
(childPosition >= srcFirst)Description
TRUEevaluated 387 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
76-463
705 persistent_moved_explicitly.append(data);-
706 } else {
executed 387 times by 2 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
387
707 persistent_moved_in_source.append(data);-
708 }
executed 415 times by 2 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
415
709 }-
710 persistent.moved.push(persistent_moved_explicitly);-
711 persistent.moved.push(persistent_moved_in_source);-
712 persistent.moved.push(persistent_moved_in_destination);-
713}
executed 72 times by 5 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
72
714-
715/*!-
716 \internal-
717-
718 Moves persistent indexes \a indexes by amount \a change. The change will be either a change in row value or a change in-
719 column value depending on the value of \a orientation. The indexes may also be moved to a different parent if \a parent-
720 differs from the existing parent for the index.-
721*/-
722void QAbstractItemModelPrivate::movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation)-
723{-
724 QVector<QPersistentModelIndexData *>::const_iterator it;-
725 const QVector<QPersistentModelIndexData *>::const_iterator begin = indexes.constBegin();-
726 const QVector<QPersistentModelIndexData *>::const_iterator end = indexes.constEnd();-
727-
728 for (it = begin; it != end; ++it)
it != endDescription
TRUEevaluated 1178 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEevaluated 216 times by 5 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
216-1178
729 {-
730 QPersistentModelIndexData *data = *it;-
731-
732 int row = data->index.row();-
733 int column = data->index.column();-
734-
735 if (Qt::Vertical == orientation)
Qt::Vertical == orientationDescription
TRUEevaluated 1178 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEnever evaluated
0-1178
736 row += change;
executed 1178 times by 2 tests: row += change;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
1178
737 else-
738 column += change;
never executed: column += change;
0
739-
740 persistent.indexes.erase(persistent.indexes.constFind(data->index));-
741 data->index = q_func()->index(row, column, parent);-
742 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 1178 times by 2 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
FALSEnever evaluated
0-1178
743 persistent.insertMultiAtEnd(data->index, data);-
744 } else {
executed 1178 times by 2 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
1178
745 qWarning() << "QAbstractItemModel::endMoveRows: Invalid index (" << row << "," << column << ") in model" << q_func();-
746 }
never executed: end of block
0
747 }-
748}
executed 216 times by 5 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
216
749-
750void QAbstractItemModelPrivate::itemsMoved(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)-
751{-
752 QVector<QPersistentModelIndexData *> moved_in_destination = persistent.moved.pop();-
753 QVector<QPersistentModelIndexData *> moved_in_source = persistent.moved.pop();-
754 QVector<QPersistentModelIndexData *> moved_explicitly = persistent.moved.pop();-
755-
756 const bool sameParent = (sourceParent == destinationParent);-
757 const bool movingUp = (sourceFirst > destinationChild);-
758-
759 const int explicit_change = (!sameParent || movingUp) ? destinationChild - sourceFirst : destinationChild - sourceLast - 1 ;
!sameParentDescription
TRUEevaluated 46 times by 4 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QSortFilterProxyModel
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
movingUpDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
12-46
760 const int source_change = (!sameParent || !movingUp) ? -1*(sourceLast - sourceFirst + 1) : sourceLast - sourceFirst + 1 ;
!sameParentDescription
TRUEevaluated 46 times by 4 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QSortFilterProxyModel
FALSEevaluated 26 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
!movingUpDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
12-46
761 const int destination_change = sourceLast - sourceFirst + 1;-
762-
763 movePersistentIndexes(moved_explicitly, explicit_change, destinationParent, orientation);-
764 movePersistentIndexes(moved_in_source, source_change, sourceParent, orientation);-
765 movePersistentIndexes(moved_in_destination, destination_change, destinationParent, orientation);-
766}
executed 72 times by 5 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
72
767-
768void QAbstractItemModelPrivate::rowsAboutToBeRemoved(const QModelIndex &parent,-
769 int first, int last)-
770{-
771 QVector<QPersistentModelIndexData *> persistent_moved;-
772 QVector<QPersistentModelIndexData *> persistent_invalidated;-
773 // find the persistent indexes that are affected by the change, either by being in the removed subtree-
774 // or by being on the same level and below the removed rows-
775 for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin();-
776 it != persistent.indexes.constEnd(); ++it) {
it != persiste...xes.constEnd()Description
TRUEevaluated 3751 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 2919 times by 31 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • ...
2919-3751
777 QPersistentModelIndexData *data = *it;-
778 bool level_changed = false;-
779 QModelIndex current = data->index;-
780 while (current.isValid()) {
current.isValid()Description
TRUEevaluated 4572 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 223 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
223-4572
781 QModelIndex current_parent = current.parent();-
782 if (current_parent == parent) { // on the same level as the change
current_parent == parentDescription
TRUEevaluated 3528 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 1044 times by 9 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
1044-3528
783 if (!level_changed && current.row() > last) // below the removed rows
!level_changedDescription
TRUEevaluated 3212 times by 18 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 316 times by 6 tests
Evaluated by:
  • tst_QDirModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
current.row() > lastDescription
TRUEevaluated 1097 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2115 times by 16 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
316-3212
784 persistent_moved.append(data);
executed 1097 times by 12 tests: persistent_moved.append(data);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
1097
785 else if (current.row() <= last && current.row() >= first) // in the removed subtree
current.row() <= lastDescription
TRUEevaluated 2316 times by 17 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 115 times by 1 test
Evaluated by:
  • tst_QStandardItemModel
current.row() >= firstDescription
TRUEevaluated 1191 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 1125 times by 11 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
115-2316
786 persistent_invalidated.append(data);
executed 1191 times by 15 tests: persistent_invalidated.append(data);
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1191
787 break;
executed 3528 times by 18 tests: break;
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
3528
788 }-
789 current = current_parent;-
790 level_changed = true;-
791 }
executed 1044 times by 9 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
1044
792 }
executed 3751 times by 18 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
3751
793-
794 persistent.moved.push(persistent_moved);-
795 persistent.invalidated.push(persistent_invalidated);-
796}
executed 2919 times by 31 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • ...
2919
797-
798void QAbstractItemModelPrivate::rowsRemoved(const QModelIndex &parent,-
799 int first, int last)-
800{-
801 QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop();-
802 int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested-
803 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin();-
804 it != persistent_moved.constEnd(); ++it) {
it != persiste...ved.constEnd()Description
TRUEevaluated 1097 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEevaluated 2919 times by 31 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • ...
1097-2919
805 QPersistentModelIndexData *data = *it;-
806 QModelIndex old = data->index;-
807 persistent.indexes.erase(persistent.indexes.constFind(old));-
808 data->index = q_func()->index(old.row() - count, old.column(), parent);-
809 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 1097 times by 12 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
FALSEnever evaluated
0-1097
810 persistent.insertMultiAtEnd(data->index, data);-
811 } else {
executed 1097 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QFileDialog2
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTreeView
  • tst_QTreeWidget
1097
812 qWarning() << "QAbstractItemModel::endRemoveRows: Invalid index (" << old.row() - count << ',' << old.column() << ") in model" << q_func();-
813 }
never executed: end of block
0
814 }-
815 QVector<QPersistentModelIndexData *> persistent_invalidated = persistent.invalidated.pop();-
816 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_invalidated.constBegin();-
817 it != persistent_invalidated.constEnd(); ++it) {
it != persiste...ted.constEnd()Description
TRUEevaluated 1191 times by 15 tests
Evaluated by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 2919 times by 31 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • ...
1191-2919
818 QPersistentModelIndexData *data = *it;-
819 persistent.indexes.erase(persistent.indexes.constFind(data->index));-
820 data->index = QModelIndex();-
821 data->model = 0;-
822 }
executed 1191 times by 15 tests: end of block
Executed by:
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
1191
823}
executed 2919 times by 31 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlRelationalTableModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QStringListModel
  • ...
2919
824-
825void QAbstractItemModelPrivate::columnsAboutToBeInserted(const QModelIndex &parent,-
826 int first, int last)-
827{-
828 Q_Q(QAbstractItemModel);-
829 Q_UNUSED(last);-
830 QVector<QPersistentModelIndexData *> persistent_moved;-
831 if (first < q->columnCount(parent)) {
first < q->columnCount(parent)Description
TRUEevaluated 338 times by 11 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
FALSEevaluated 13194 times by 31 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItem
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • ...
338-13194
832 for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin();-
833 it != persistent.indexes.constEnd(); ++it) {
it != persiste...xes.constEnd()Description
TRUEevaluated 63 times by 6 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QStandardItemModel
  • tst_QTableView
FALSEevaluated 338 times by 11 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
63-338
834 QPersistentModelIndexData *data = *it;-
835 const QModelIndex &index = data->index;-
836 if (index.column() >= first && index.isValid() && index.parent() == parent)
index.column() >= firstDescription
TRUEevaluated 30 times by 5 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QItemModel
  • tst_QStandardItemModel
  • tst_QTableView
FALSEevaluated 33 times by 5 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QTableView
index.isValid()Description
TRUEevaluated 30 times by 5 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QItemModel
  • tst_QStandardItemModel
  • tst_QTableView
FALSEnever evaluated
index.parent() == parentDescription
TRUEevaluated 15 times by 4 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QStandardItemModel
  • tst_QTableView
FALSEevaluated 15 times by 1 test
Evaluated by:
  • tst_QItemModel
0-33
837 persistent_moved.append(data);
executed 15 times by 4 tests: persistent_moved.append(data);
Executed by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QStandardItemModel
  • tst_QTableView
15
838 }
executed 63 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QStandardItemModel
  • tst_QTableView
63
839 }
executed 338 times by 11 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
338
840 persistent.moved.push(persistent_moved);-
841}
executed 13532 times by 33 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
13532
842-
843void QAbstractItemModelPrivate::columnsInserted(const QModelIndex &parent,-
844 int first, int last)-
845{-
846 QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop();-
847 int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested-
848 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin();-
849 it != persistent_moved.constEnd(); ++it) {
it != persiste...ved.constEnd()Description
TRUEevaluated 15 times by 4 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QStandardItemModel
  • tst_QTableView
FALSEevaluated 13532 times by 33 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
15-13532
850 QPersistentModelIndexData *data = *it;-
851 QModelIndex old = data->index;-
852 persistent.indexes.erase(persistent.indexes.constFind(old));-
853 data->index = q_func()->index(old.row(), old.column() + count, parent);-
854 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 15 times by 4 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QStandardItemModel
  • tst_QTableView
FALSEnever evaluated
0-15
855 persistent.insertMultiAtEnd(data->index, data);-
856 } else {
executed 15 times by 4 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QStandardItemModel
  • tst_QTableView
15
857 qWarning() << "QAbstractItemModel::endInsertColumns: Invalid index (" << old.row() << ',' << old.column() + count << ") in model" << q_func();-
858 }
never executed: end of block
0
859 }-
860}
executed 13532 times by 33 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QSidebar
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlTableModel
  • tst_QStandardItem
  • tst_QStandardItemModel
  • ...
13532
861-
862void QAbstractItemModelPrivate::columnsAboutToBeRemoved(const QModelIndex &parent,-
863 int first, int last)-
864{-
865 QVector<QPersistentModelIndexData *> persistent_moved;-
866 QVector<QPersistentModelIndexData *> persistent_invalidated;-
867 // find the persistent indexes that are affected by the change, either by being in the removed subtree-
868 // or by being on the same level and to the right of the removed columns-
869 for (QHash<QModelIndex, QPersistentModelIndexData *>::const_iterator it = persistent.indexes.constBegin();-
870 it != persistent.indexes.constEnd(); ++it) {
it != persiste...xes.constEnd()Description
TRUEevaluated 100 times by 11 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 210 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
100-210
871 QPersistentModelIndexData *data = *it;-
872 bool level_changed = false;-
873 QModelIndex current = data->index;-
874 while (current.isValid()) {
current.isValid()Description
TRUEevaluated 101 times by 11 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QItemModel
35-101
875 QModelIndex current_parent = current.parent();-
876 if (current_parent == parent) { // on the same level as the change
current_parent == parentDescription
TRUEevaluated 65 times by 11 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • tst_QItemModel
  • tst_QStandardItemModel
36-65
877 if (!level_changed && current.column() > last) // right of the removed columns
!level_changedDescription
TRUEevaluated 64 times by 11 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QStandardItemModel
current.column() > lastDescription
TRUEevaluated 15 times by 6 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
FALSEevaluated 49 times by 9 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
1-64
878 persistent_moved.append(data);
executed 15 times by 6 tests: persistent_moved.append(data);
Executed by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
15
879 else if (current.column() <= last && current.column() >= first) // in the removed subtree
current.column() <= lastDescription
TRUEevaluated 50 times by 9 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
FALSEnever evaluated
current.column() >= firstDescription
TRUEevaluated 26 times by 7 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 24 times by 7 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
0-50
880 persistent_invalidated.append(data);
executed 26 times by 7 tests: persistent_invalidated.append(data);
Executed by:
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
26
881 break;
executed 65 times by 11 tests: break;
Executed by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
65
882 }-
883 current = current_parent;-
884 level_changed = true;-
885 }
executed 36 times by 2 tests: end of block
Executed by:
  • tst_QItemModel
  • tst_QStandardItemModel
36
886 }
executed 100 times by 11 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
100
887-
888 persistent.moved.push(persistent_moved);-
889 persistent.invalidated.push(persistent_invalidated);-
890-
891}
executed 210 times by 16 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
210
892-
893void QAbstractItemModelPrivate::columnsRemoved(const QModelIndex &parent,-
894 int first, int last)-
895{-
896 QVector<QPersistentModelIndexData *> persistent_moved = persistent.moved.pop();-
897 int count = (last - first) + 1; // it is important to only use the delta, because the change could be nested-
898 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_moved.constBegin();-
899 it != persistent_moved.constEnd(); ++it) {
it != persiste...ved.constEnd()Description
TRUEevaluated 15 times by 6 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
FALSEevaluated 210 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
15-210
900 QPersistentModelIndexData *data = *it;-
901 QModelIndex old = data->index;-
902 persistent.indexes.erase(persistent.indexes.constFind(old));-
903 data->index = q_func()->index(old.row(), old.column() - count, parent);-
904 if (data->index.isValid()) {
data->index.isValid()Description
TRUEevaluated 15 times by 6 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
FALSEnever evaluated
0-15
905 persistent.insertMultiAtEnd(data->index, data);-
906 } else {
executed 15 times by 6 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
15
907 qWarning() << "QAbstractItemModel::endRemoveColumns: Invalid index (" << old.row() << ',' << old.column() - count << ") in model" << q_func();-
908 }
never executed: end of block
0
909 }-
910 QVector<QPersistentModelIndexData *> persistent_invalidated = persistent.invalidated.pop();-
911 for (QVector<QPersistentModelIndexData *>::const_iterator it = persistent_invalidated.constBegin();-
912 it != persistent_invalidated.constEnd(); ++it) {
it != persiste...ted.constEnd()Description
TRUEevaluated 26 times by 7 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
FALSEevaluated 210 times by 16 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
26-210
913 QPersistentModelIndexData *data = *it;-
914 persistent.indexes.erase(persistent.indexes.constFind(data->index));-
915 data->index = QModelIndex();-
916 data->model = 0;-
917 }
executed 26 times by 7 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTreeView
26
918}
executed 210 times by 16 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QDateTimeEdit
  • tst_QHeaderView
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTableWidget
  • tst_QTreeView
  • tst_QTreeWidget
210
919-
920/*!-
921 \since 4.8-
922-
923 This slot is called just after the internal data of a model is cleared-
924 while it is being reset.-
925-
926 This slot is provided the convenience of subclasses of concrete proxy-
927 models, such as subclasses of QSortFilterProxyModel which maintain extra-
928 data.-
929-
930 \snippet code/src_corelib_kernel_qabstractitemmodel.cpp 12-
931-
932 \note Due to a mistake, this slot is missing in Qt 5.0.-
933-
934 \sa modelAboutToBeReset(), modelReset()-
935*/-
936void QAbstractItemModel::resetInternalData()-
937{-
938-
939}-
940-
941/*!-
942 \class QModelIndex-
943 \inmodule QtCore-
944-
945 \brief The QModelIndex class is used to locate data in a data model.-
946-
947 \ingroup model-view-
948-
949-
950 This class is used as an index into item models derived from-
951 QAbstractItemModel. The index is used by item views, delegates, and-
952 selection models to locate an item in the model.-
953-
954 New QModelIndex objects are created by the model using the-
955 QAbstractItemModel::createIndex() function. An \e invalid model index can-
956 be constructed with the QModelIndex constructor. Invalid indexes are often-
957 used as parent indexes when referring to top-level items in a model.-
958-
959 Model indexes refer to items in models, and contain all the information-
960 required to specify their locations in those models. Each index is located-
961 in a given row and column, and may have a parent index; use row(),-
962 column(), and parent() to obtain this information. Each top-level item in a-
963 model is represented by a model index that does not have a parent index --
964 in this case, parent() will return an invalid model index, equivalent to an-
965 index constructed with the zero argument form of the QModelIndex()-
966 constructor.-
967-
968 To obtain a model index that refers to an existing item in a model, call-
969 QAbstractItemModel::index() with the required row and column values, and-
970 the model index of the parent. When referring to top-level items in a-
971 model, supply QModelIndex() as the parent index.-
972-
973 The model() function returns the model that the index references as a-
974 QAbstractItemModel. The child() function is used to examine items held-
975 under the index in the model. The sibling() function allows you to traverse-
976 items in the model on the same level as the index.-
977-
978 \note Model indexes should be used immediately and then discarded. You-
979 should not rely on indexes to remain valid after calling model functions-
980 that change the structure of the model or delete items. If you need to-
981 keep a model index over time use a QPersistentModelIndex.-
982-
983 \sa {Model/View Programming}, QPersistentModelIndex, QAbstractItemModel-
984*/-
985-
986/*!-
987 \fn QModelIndex::QModelIndex()-
988-
989 Creates a new empty model index. This type of model index is used to-
990 indicate that the position in the model is invalid.-
991-
992 \sa isValid(), QAbstractItemModel-
993*/-
994-
995/*!-
996 \fn QModelIndex::QModelIndex(int row, int column, void *data, const QAbstractItemModel *model)-
997-
998 \internal-
999-
1000 Creates a new model index at the given \a row and \a column,-
1001 pointing to some \a data.-
1002*/-
1003-
1004/*!-
1005 \fn int QModelIndex::row() const-
1006-
1007 Returns the row this model index refers to.-
1008*/-
1009-
1010-
1011/*!-
1012 \fn int QModelIndex::column() const-
1013-
1014 Returns the column this model index refers to.-
1015*/-
1016-
1017-
1018/*!-
1019 \fn void *QModelIndex::internalPointer() const-
1020-
1021 Returns a \c{void} \c{*} pointer used by the model to associate-
1022 the index with the internal data structure.-
1023-
1024 \sa QAbstractItemModel::createIndex()-
1025*/-
1026-
1027/*!-
1028 \fn quintptr QModelIndex::internalId() const-
1029-
1030 Returns a \c{quintptr} used by the model to associate-
1031 the index with the internal data structure.-
1032-
1033 \sa QAbstractItemModel::createIndex()-
1034*/-
1035-
1036/*!-
1037 \fn bool QModelIndex::isValid() const-
1038-
1039 Returns \c{true} if this model index is valid; otherwise returns \c{false}.-
1040-
1041 A valid index belongs to a model, and has non-negative row and column-
1042 numbers.-
1043-
1044 \sa model(), row(), column()-
1045*/-
1046-
1047/*!-
1048 \fn const QAbstractItemModel *QModelIndex::model() const-
1049-
1050 Returns a pointer to the model containing the item that this index-
1051 refers to.-
1052-
1053 A const pointer to the model is returned because calls to non-const-
1054 functions of the model might invalidate the model index and possibly-
1055 crash your application.-
1056*/-
1057-
1058/*!-
1059 \fn QModelIndex QModelIndex::sibling(int row, int column) const-
1060-
1061 Returns the sibling at \a row and \a column. If there is no sibling at this-
1062 position, an invalid QModelIndex is returned.-
1063-
1064 \sa parent(), child()-
1065*/-
1066-
1067/*!-
1068 \fn QModelIndex QModelIndex::child(int row, int column) const-
1069-
1070 Returns the child of the model index that is stored in the given \a row and-
1071 \a column.-
1072-
1073 \note This function does not work for an invalid model index which is often-
1074 used as the root index.-
1075-
1076 \sa parent(), sibling()-
1077*/-
1078-
1079/*!-
1080 \fn QVariant QModelIndex::data(int role) const-
1081-
1082 Returns the data for the given \a role for the item referred to by the-
1083 index.-
1084*/-
1085-
1086/*!-
1087 \fn Qt::ItemFlags QModelIndex::flags() const-
1088 \since 4.2-
1089-
1090 Returns the flags for the item referred to by the index.-
1091*/-
1092-
1093/*!-
1094 \fn bool QModelIndex::operator==(const QModelIndex &other) const-
1095-
1096 Returns \c{true} if this model index refers to the same location as the-
1097 \a other model index; otherwise returns \c{false}.-
1098-
1099 All values in the model index are used when comparing with another model-
1100 index.-
1101*/-
1102-
1103-
1104/*!-
1105 \fn bool QModelIndex::operator!=(const QModelIndex &other) const-
1106-
1107 Returns \c{true} if this model index does not refer to the same location as-
1108 the \a other model index; otherwise returns \c{false}.-
1109*/-
1110-
1111-
1112/*!-
1113 \fn QModelIndex QModelIndex::parent() const-
1114-
1115 Returns the parent of the model index, or QModelIndex() if it has no-
1116 parent.-
1117-
1118 \sa child(), sibling(), model()-
1119*/-
1120-
1121/*!-
1122 \class QAbstractItemModel-
1123 \inmodule QtCore-
1124-
1125 \brief The QAbstractItemModel class provides the abstract interface for-
1126 item model classes.-
1127-
1128 \ingroup model-view-
1129-
1130-
1131 The QAbstractItemModel class defines the standard interface that item-
1132 models must use to be able to interoperate with other components in the-
1133 model/view architecture. It is not supposed to be instantiated directly.-
1134 Instead, you should subclass it to create new models.-
1135-
1136 The QAbstractItemModel class is one of the \l{Model/View Classes}-
1137 and is part of Qt's \l{Model/View Programming}{model/view framework}. It-
1138 can be used as the underlying data model for the item view elements in-
1139 QML or the item view classes in the Qt Widgets module.-
1140-
1141 If you need a model to use with an item view such as QML's List View-
1142 element or the C++ widgets QListView or QTableView, you should consider-
1143 subclassing QAbstractListModel or QAbstractTableModel instead of this class.-
1144-
1145 The underlying data model is exposed to views and delegates as a hierarchy-
1146 of tables. If you do not make use of the hierarchy, then the model is a-
1147 simple table of rows and columns. Each item has a unique index specified by-
1148 a QModelIndex.-
1149-
1150 \image modelindex-no-parent.png-
1151-
1152 Every item of data that can be accessed via a model has an associated model-
1153 index. You can obtain this model index using the index() function. Each-
1154 index may have a sibling() index; child items have a parent() index.-
1155-
1156 Each item has a number of data elements associated with it and they can be-
1157 retrieved by specifying a role (see \l Qt::ItemDataRole) to the model's-
1158 data() function. Data for all available roles can be obtained at the same-
1159 time using the itemData() function.-
1160-
1161 Data for each role is set using a particular \l Qt::ItemDataRole. Data for-
1162 individual roles are set individually with setData(), or they can be set-
1163 for all roles with setItemData().-
1164-
1165 Items can be queried with flags() (see \l Qt::ItemFlag) to see if they can-
1166 be selected, dragged, or manipulated in other ways.-
1167-
1168 If an item has child objects, hasChildren() returns \c{true} for the-
1169 corresponding index.-
1170-
1171 The model has a rowCount() and a columnCount() for each level of the-
1172 hierarchy. Rows and columns can be inserted and removed with insertRows(),-
1173 insertColumns(), removeRows(), and removeColumns().-
1174-
1175 The model emits signals to indicate changes. For example, dataChanged() is-
1176 emitted whenever items of data made available by the model are changed.-
1177 Changes to the headers supplied by the model cause headerDataChanged() to-
1178 be emitted. If the structure of the underlying data changes, the model can-
1179 emit layoutChanged() to indicate to any attached views that they should-
1180 redisplay any items shown, taking the new structure into account.-
1181-
1182 The items available through the model can be searched for particular data-
1183 using the match() function.-
1184-
1185 To sort the model, you can use sort().-
1186-
1187-
1188 \section1 Subclassing-
1189-
1190 \note Some general guidelines for subclassing models are available in the-
1191 \l{Model Subclassing Reference}.-
1192-
1193 When subclassing QAbstractItemModel, at the very least you must implement-
1194 index(), parent(), rowCount(), columnCount(), and data(). These functions-
1195 are used in all read-only models, and form the basis of editable models.-
1196-
1197 You can also reimplement hasChildren() to provide special behavior for-
1198 models where the implementation of rowCount() is expensive. This makes it-
1199 possible for models to restrict the amount of data requested by views, and-
1200 can be used as a way to implement lazy population of model data.-
1201-
1202 To enable editing in your model, you must also implement setData(), and-
1203 reimplement flags() to ensure that \c ItemIsEditable is returned. You can-
1204 also reimplement headerData() and setHeaderData() to control the way the-
1205 headers for your model are presented.-
1206-
1207 The dataChanged() and headerDataChanged() signals must be emitted-
1208 explicitly when reimplementing the setData() and setHeaderData() functions,-
1209 respectively.-
1210-
1211 Custom models need to create model indexes for other components to use. To-
1212 do this, call createIndex() with suitable row and column numbers for the-
1213 item, and an identifier for it, either as a pointer or as an integer value.-
1214 The combination of these values must be unique for each item. Custom models-
1215 typically use these unique identifiers in other reimplemented functions to-
1216 retrieve item data and access information about the item's parents and-
1217 children. See the \l{Simple Tree Model Example} for more information about-
1218 unique identifiers.-
1219-
1220 It is not necessary to support every role defined in Qt::ItemDataRole.-
1221 Depending on the type of data contained within a model, it may only be-
1222 useful to implement the data() function to return valid information for-
1223 some of the more common roles. Most models provide at least a textual-
1224 representation of item data for the Qt::DisplayRole, and well-behaved-
1225 models should also provide valid information for the Qt::ToolTipRole and-
1226 Qt::WhatsThisRole. Supporting these roles enables models to be used with-
1227 standard Qt views. However, for some models that handle highly-specialized-
1228 data, it may be appropriate to provide data only for user-defined roles.-
1229-
1230 Models that provide interfaces to resizable data structures can provide-
1231 implementations of insertRows(), removeRows(), insertColumns(),and-
1232 removeColumns(). When implementing these functions, it is important to-
1233 notify any connected views about changes to the model's dimensions both-
1234 \e before and \e after they occur:-
1235-
1236 \list-
1237 \li An insertRows() implementation must call beginInsertRows() \e before-
1238 inserting new rows into the data structure, and endInsertRows()-
1239 \e{immediately afterwards}.-
1240 \li An insertColumns() implementation must call beginInsertColumns()-
1241 \e before inserting new columns into the data structure, and-
1242 endInsertColumns() \e{immediately afterwards}.-
1243 \li A removeRows() implementation must call beginRemoveRows() \e before-
1244 the rows are removed from the data structure, and endRemoveRows()-
1245 \e{immediately afterwards}.-
1246 \li A removeColumns() implementation must call beginRemoveColumns()-
1247 \e before the columns are removed from the data structure, and-
1248 endRemoveColumns() \e{immediately afterwards}.-
1249 \endlist-
1250-
1251 The \e private signals that these functions emit give attached components-
1252 the chance to take action before any data becomes unavailable. The-
1253 encapsulation of the insert and remove operations with these begin and end-
1254 functions also enables the model to manage \l{QPersistentModelIndex}-
1255 {persistent model indexes} correctly. \b{If you want selections to be-
1256 handled properly, you must ensure that you call these functions.} If you-
1257 insert or remove an item with children, you do not need to call these-
1258 functions for the child items. In other words, the parent item will take-
1259 care of its child items.-
1260-
1261 To create models that populate incrementally, you can reimplement-
1262 fetchMore() and canFetchMore(). If the reimplementation of fetchMore() adds-
1263 rows to the model, \l{QAbstractItemModel::}{beginInsertRows()} and-
1264 \l{QAbstractItemModel::}{endInsertRows()} must be called.-
1265-
1266 \sa {Model Classes}, {Model Subclassing Reference}, QModelIndex,-
1267 QAbstractItemView, {Using drag and drop with item views},-
1268 {Simple DOM Model Example}, {Simple Tree Model Example},-
1269 {Editable Tree Model Example}, {Fetch More Example}-
1270*/-
1271-
1272/*!-
1273 \fn QModelIndex QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const = 0-
1274-
1275 Returns the index of the item in the model specified by the given \a row,-
1276 \a column and \a parent index.-
1277-
1278 When reimplementing this function in a subclass, call createIndex() to-
1279 generate model indexes that other components can use to refer to items in-
1280 your model.-
1281-
1282 \sa createIndex()-
1283*/-
1284-
1285/*!-
1286 \fn bool QAbstractItemModel::insertColumn(int column, const QModelIndex &parent)-
1287-
1288 Inserts a single column before the given \a column in the child items of-
1289 the \a parent specified.-
1290-
1291 Returns \c{true} if the column is inserted; otherwise returns \c{false}.-
1292-
1293 \sa insertColumns(), insertRow(), removeColumn()-
1294*/-
1295-
1296/*!-
1297 \fn bool QAbstractItemModel::insertRow(int row, const QModelIndex &parent)-
1298-
1299 Inserts a single row before the given \a row in the child items of the-
1300 \a parent specified.-
1301-
1302 \note This function calls the virtual method insertRows.-
1303-
1304 Returns \c{true} if the row is inserted; otherwise returns \c{false}.-
1305-
1306 \sa insertRows(), insertColumn(), removeRow()-
1307*/-
1308-
1309/*!-
1310 \fn QModelIndex QAbstractItemModel::parent(const QModelIndex &index) const = 0-
1311-
1312 Returns the parent of the model item with the given \a index. If the item-
1313 has no parent, an invalid QModelIndex is returned.-
1314-
1315 A common convention used in models that expose tree data structures is that-
1316 only items in the first column have children. For that case, when-
1317 reimplementing this function in a subclass the column of the returned-
1318 QModelIndex would be 0.-
1319-
1320 When reimplementing this function in a subclass, be careful to avoid-
1321 calling QModelIndex member functions, such as QModelIndex::parent(), since-
1322 indexes belonging to your model will simply call your implementation,-
1323 leading to infinite recursion.-
1324-
1325 \sa createIndex()-
1326*/-
1327-
1328/*!-
1329 \fn bool QAbstractItemModel::removeColumn(int column, const QModelIndex &parent)-
1330-
1331 Removes the given \a column from the child items of the \a parent-
1332 specified.-
1333-
1334 Returns \c{true} if the column is removed; otherwise returns \c{false}.-
1335-
1336 \sa removeColumns(), removeRow(), insertColumn()-
1337*/-
1338-
1339/*!-
1340 \fn bool QAbstractItemModel::removeRow(int row, const QModelIndex &parent)-
1341-
1342 Removes the given \a row from the child items of the \a parent specified.-
1343-
1344 Returns \c{true} if the row is removed; otherwise returns \c{false}.-
1345-
1346 This is a convenience function that calls removeRows(). The-
1347 QAbstractItemModel implementation of removeRows() does nothing.-
1348-
1349 \sa removeRows(), removeColumn(), insertRow()-
1350*/-
1351-
1352/*!-
1353 \fn bool QAbstractItemModel::moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild)-
1354-
1355 On models that support this, moves \a sourceRow from \a sourceParent to \a destinationChild under-
1356 \a destinationParent.-
1357-
1358 Returns \c{true} if the rows were successfully moved; otherwise returns-
1359 \c{false}.-
1360-
1361 \sa moveRows(), moveColumn()-
1362*/-
1363-
1364/*!-
1365 \fn bool QAbstractItemModel::moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild)-
1366-
1367 On models that support this, moves \a sourceColumn from \a sourceParent to \a destinationChild under-
1368 \a destinationParent.-
1369-
1370 Returns \c{true} if the columns were successfully moved; otherwise returns-
1371 \c{false}.-
1372-
1373 \sa moveColumns(), moveRow()-
1374*/-
1375-
1376-
1377/*!-
1378 \fn void QAbstractItemModel::headerDataChanged(Qt::Orientation orientation, int first, int last)-
1379-
1380 This signal is emitted whenever a header is changed. The \a orientation-
1381 indicates whether the horizontal or vertical header has changed. The-
1382 sections in the header from the \a first to the \a last need to be updated.-
1383-
1384 When reimplementing the setHeaderData() function, this signal must be-
1385 emitted explicitly.-
1386-
1387 If you are changing the number of columns or rows you do not need to emit-
1388 this signal, but use the begin/end functions (refer to the section on-
1389 subclassing in the QAbstractItemModel class description for details).-
1390-
1391 \sa headerData(), setHeaderData(), dataChanged()-
1392*/-
1393-
1394-
1395/*!-
1396 \enum QAbstractItemModel::LayoutChangeHint-
1397-
1398 This enum describes the way the model changes layout.-
1399-
1400 \value NoLayoutChangeHint No hint is available.-
1401 \value VerticalSortHint Rows are being sorted.-
1402 \value HorizontalSortHint Columns are being sorted.-
1403-
1404 Note that VerticalSortHint and HorizontalSortHint carry the meaning that-
1405 items are being moved within the same parent, not moved to a different-
1406 parent in the model, and not filtered out or in.-
1407*/-
1408-
1409/*!-
1410 \fn void QAbstractItemModel::layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)-
1411 \since 5.0-
1412-
1413 This signal is emitted just before the layout of a model is changed.-
1414 Components connected to this signal use it to adapt to changes in the-
1415 model's layout.-
1416-
1417 Subclasses should update any persistent model indexes after emitting-
1418 layoutAboutToBeChanged().-
1419-
1420 The optional \a parents parameter is used to give a more specific notification-
1421 about what parts of the layout of the model are changing. An empty list indicates-
1422 a change to the layout of the entire model. The order of elements in the \a parents list is not significant. The optional \a hint parameter is used-
1423 to give a hint about what is happening while the model is relayouting.-
1424-
1425 \sa layoutChanged(), changePersistentIndex()-
1426*/-
1427-
1428/*!-
1429 \fn void QAbstractItemModel::layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>(), QAbstractItemModel::LayoutChangeHint hint = QAbstractItemModel::NoLayoutChangeHint)-
1430 \since 5.0-
1431-
1432 This signal is emitted whenever the layout of items exposed by the model-
1433 has changed; for example, when the model has been sorted. When this signal-
1434 is received by a view, it should update the layout of items to reflect this-
1435 change.-
1436-
1437 When subclassing QAbstractItemModel or QAbstractProxyModel, ensure that you-
1438 emit layoutAboutToBeChanged() before changing the order of items or-
1439 altering the structure of the data you expose to views, and emit-
1440 layoutChanged() after changing the layout.-
1441-
1442 The optional \a parents parameter is used to give a more specific notification-
1443 about what parts of the layout of the model are changing. An empty list indicates-
1444 a change to the layout of the entire model. The order of elements in the \a parents list is not significant. The optional \a hint parameter is used-
1445 to give a hint about what is happening while the model is relayouting.-
1446-
1447 Subclasses should update any persistent model indexes before emitting-
1448 layoutChanged(). In other words, when the structure changes:-
1449-
1450 \list-
1451 \li emit layoutAboutToBeChanged-
1452 \li Remember the QModelIndex that will change-
1453 \li Update your internal data-
1454 \li Call changePersistentIndex()-
1455 \li emit layoutChanged-
1456 \endlist-
1457-
1458 \sa layoutAboutToBeChanged(), dataChanged(), headerDataChanged(), modelReset(),-
1459 changePersistentIndex()-
1460*/-
1461-
1462/*!-
1463 Constructs an abstract item model with the given \a parent.-
1464*/-
1465QAbstractItemModel::QAbstractItemModel(QObject *parent)-
1466 : QObject(*new QAbstractItemModelPrivate, parent)-
1467{-
1468}
executed 1568 times by 48 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • ...
1568
1469-
1470/*!-
1471 \internal-
1472*/-
1473QAbstractItemModel::QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent)-
1474 : QObject(dd, parent)-
1475{-
1476}
executed 3826 times by 44 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDirModel
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLayout
  • ...
3826
1477-
1478/*!-
1479 Destroys the abstract item model.-
1480*/-
1481QAbstractItemModel::~QAbstractItemModel()-
1482{-
1483 d_func()->invalidatePersistentIndexes();-
1484}
executed 5227 times by 98 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • 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_QGridLayout
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QInputDialog
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • ...
5227
1485-
1486-
1487/*!-
1488 \fn int QAbstractItemModel::rowCount(const QModelIndex &parent) const-
1489-
1490 Returns the number of rows under the given \a parent. When the parent is-
1491 valid it means that rowCount is returning the number of children of parent.-
1492-
1493 \note When implementing a table based model, rowCount() should return 0-
1494 when the parent is valid.-
1495-
1496 \sa columnCount()-
1497*/-
1498-
1499/*!-
1500 \fn int QAbstractItemModel::columnCount(const QModelIndex &parent) const-
1501-
1502 Returns the number of columns for the children of the given \a parent.-
1503-
1504 In most subclasses, the number of columns is independent of the \a parent.-
1505-
1506 For example:-
1507-
1508 \snippet ../widgets/itemviews/simpledommodel/dommodel.cpp 2-
1509-
1510 \note When implementing a table based model, columnCount() should return 0-
1511 when the parent is valid.-
1512-
1513 \sa rowCount()-
1514*/-
1515-
1516/*!-
1517 \fn void QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>())-
1518-
1519 This signal is emitted whenever the data in an existing item changes.-
1520-
1521 If the items are of the same parent, the affected ones are those between-
1522 \a topLeft and \a bottomRight inclusive. If the items do not have the same-
1523 parent, the behavior is undefined.-
1524-
1525 When reimplementing the setData() function, this signal must be emitted-
1526 explicitly.-
1527-
1528 The optional \a roles argument can be used to specify which data roles have actually-
1529 been modified. An empty vector in the roles argument means that all roles should be-
1530 considered modified. The order of elements in the roles argument does not have any-
1531 relevance.-
1532-
1533 \sa headerDataChanged(), setData(), layoutChanged()-
1534*/-
1535-
1536/*!-
1537 \fn void QAbstractItemModel::rowsInserted(const QModelIndex &parent, int first, int last)-
1538-
1539 This signal is emitted after rows have been inserted into the-
1540 model. The new items are those between \a first and \a last-
1541 inclusive, under the given \a parent item.-
1542-
1543 \note Components connected to this signal use it to adapt to changes in the-
1544 model's dimensions. It can only be emitted by the QAbstractItemModel-
1545 implementation, and cannot be explicitly emitted in subclass code.-
1546-
1547 \sa insertRows(), beginInsertRows()-
1548*/-
1549-
1550/*!-
1551 \fn void QAbstractItemModel::rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)-
1552-
1553 This signal is emitted just before rows are inserted into the model. The-
1554 new items will be positioned between \a start and \a end inclusive, under-
1555 the given \a parent item.-
1556-
1557 \note Components connected to this signal use it to adapt to changes-
1558 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1559 implementation, and cannot be explicitly emitted in subclass code.-
1560-
1561 \sa insertRows(), beginInsertRows()-
1562*/-
1563-
1564/*!-
1565 \fn void QAbstractItemModel::rowsRemoved(const QModelIndex &parent, int first, int last)-
1566-
1567 This signal is emitted after rows have been removed from the model. The-
1568 removed items are those between \a first and \a last inclusive, under the-
1569 given \a parent item.-
1570-
1571 \note Components connected to this signal use it to adapt to changes-
1572 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1573 implementation, and cannot be explicitly emitted in subclass code.-
1574-
1575 \sa removeRows(), beginRemoveRows()-
1576*/-
1577-
1578/*!-
1579 \fn void QAbstractItemModel::rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)-
1580-
1581 This signal is emitted just before rows are removed from the model. The-
1582 items that will be removed are those between \a first and \a last inclusive,-
1583 under the given \a parent item.-
1584-
1585 \note Components connected to this signal use it to adapt to changes-
1586 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1587 implementation, and cannot be explicitly emitted in subclass code.-
1588-
1589 \sa removeRows(), beginRemoveRows()-
1590*/-
1591-
1592/*!-
1593 \fn void QAbstractItemModel::rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)-
1594 \since 4.6-
1595-
1596 This signal is emitted after rows have been moved within the-
1597 model. The items between \a start and \a end-
1598 inclusive, under the given \a parent item have been moved to \a destination-
1599 starting at the row \a row.-
1600-
1601 \b{Note:} Components connected to this signal use it to adapt to changes-
1602 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1603 implementation, and cannot be explicitly emitted in subclass code.-
1604-
1605 \sa beginMoveRows()-
1606*/-
1607-
1608/*!-
1609 \fn void QAbstractItemModel::rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)-
1610 \since 4.6-
1611-
1612 This signal is emitted just before rows are moved within the-
1613 model. The items that will be moved are those between \a sourceStart and \a sourceEnd-
1614 inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent-
1615 starting at the row \a destinationRow.-
1616-
1617 \b{Note:} Components connected to this signal use it to adapt to changes-
1618 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1619 implementation, and cannot be explicitly emitted in subclass code.-
1620-
1621 \sa beginMoveRows()-
1622*/-
1623-
1624/*!-
1625 \fn void QAbstractItemModel::columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)-
1626 \since 4.6-
1627-
1628 This signal is emitted after columns have been moved within the-
1629 model. The items between \a start and \a end-
1630 inclusive, under the given \a parent item have been moved to \a destination-
1631 starting at the column \a column.-
1632-
1633 \b{Note:} Components connected to this signal use it to adapt to changes-
1634 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1635 implementation, and cannot be explicitly emitted in subclass code.-
1636-
1637 \sa beginMoveRows()-
1638*/-
1639-
1640/*!-
1641 \fn void QAbstractItemModel::columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)-
1642 \since 4.6-
1643-
1644 This signal is emitted just before columns are moved within the-
1645 model. The items that will be moved are those between \a sourceStart and \a sourceEnd-
1646 inclusive, under the given \a sourceParent item. They will be moved to \a destinationParent-
1647 starting at the column \a destinationColumn.-
1648-
1649 \b{Note:} Components connected to this signal use it to adapt to changes-
1650 in the model's dimensions. It can only be emitted by the QAbstractItemModel-
1651 implementation, and cannot be explicitly emitted in subclass code.-
1652-
1653 \sa beginMoveRows()-
1654*/-
1655-
1656/*!-
1657 \fn void QAbstractItemModel::columnsInserted(const QModelIndex &parent, int first, int last)-
1658-
1659 This signal is emitted after columns have been inserted into the model. The-
1660 new items are those between \a first and \a last inclusive, under the given-
1661 \a parent item.-
1662-
1663 \note Components connected to this signal use it to adapt to changes in the-
1664 model's dimensions. It can only be emitted by the QAbstractItemModel-
1665 implementation, and cannot be explicitly emitted in subclass code.-
1666-
1667 \sa insertColumns(), beginInsertColumns()-
1668*/-
1669-
1670/*!-
1671 \fn void QAbstractItemModel::columnsAboutToBeInserted(const QModelIndex &parent, int first, int last)-
1672-
1673 This signal is emitted just before columns are inserted into the model. The-
1674 new items will be positioned between \a first and \a last inclusive, under-
1675 the given \a parent item.-
1676-
1677 \note Components connected to this signal use it to adapt to changes in the-
1678 model's dimensions. It can only be emitted by the QAbstractItemModel-
1679 implementation, and cannot be explicitly emitted in subclass code.-
1680-
1681 \sa insertColumns(), beginInsertColumns()-
1682*/-
1683-
1684/*!-
1685 \fn void QAbstractItemModel::columnsRemoved(const QModelIndex &parent, int first, int last)-
1686-
1687 This signal is emitted after columns have been removed from the model.-
1688 The removed items are those between \a first and \a last inclusive,-
1689 under the given \a parent item.-
1690-
1691 \note Components connected to this signal use it to adapt to changes in-
1692 the model's dimensions. It can only be emitted by the QAbstractItemModel-
1693 implementation, and cannot be explicitly emitted in subclass code.-
1694-
1695 \sa removeColumns(), beginRemoveColumns()-
1696*/-
1697-
1698/*!-
1699 \fn void QAbstractItemModel::columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last)-
1700-
1701 This signal is emitted just before columns are removed from the model. The-
1702 items to be removed are those between \a first and \a last inclusive, under-
1703 the given \a parent item.-
1704-
1705 \note Components connected to this signal use it to adapt to changes in the-
1706 model's dimensions. It can only be emitted by the QAbstractItemModel-
1707 implementation, and cannot be explicitly emitted in subclass code.-
1708-
1709 \sa removeColumns(), beginRemoveColumns()-
1710*/-
1711-
1712/*!-
1713 Returns \c{true} if the model returns a valid QModelIndex for \a row and-
1714 \a column with \a parent, otherwise returns \c{false}.-
1715*/-
1716bool QAbstractItemModel::hasIndex(int row, int column, const QModelIndex &parent) const-
1717{-
1718 if (row < 0 || column < 0)
row < 0Description
TRUEevaluated 586 times by 10 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
FALSEevaluated 226416 times by 32 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • ...
column < 0Description
TRUEevaluated 1340 times by 5 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAccessibility
  • tst_QItemModel
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
FALSEevaluated 225076 times by 32 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • ...
586-226416
1719 return false;
executed 1926 times by 10 tests: return false;
Executed by:
  • tst_ModelTest
  • tst_QAccessibility
  • tst_QComboBox
  • tst_QFontComboBox
  • tst_QGraphicsProxyWidget
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
1926
1720 return row < rowCount(parent) && column < columnCount(parent);
executed 225076 times by 32 tests: return row < rowCount(parent) && column < columnCount(parent);
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDateTimeEdit
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGraphicsProxyWidget
  • tst_QHeaderView
  • tst_QIdentityProxyModel
  • tst_QItemDelegate
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QLineEdit
  • tst_QListView
  • tst_QListWidget
  • tst_QMenu
  • tst_QSortFilterProxyModel
  • tst_QSqlQueryModel
  • tst_QSqlRelationalTableModel
  • ...
225076
1721}-
1722-
1723-
1724/*!-
1725 Returns \c{true} if \a parent has any children; otherwise returns \c{false}.-
1726-
1727 Use rowCount() on the parent to find out the number of children.-
1728-
1729 Note that it is undefined behavior to report that a particular index hasChildren-
1730 with this method if the same index has the flag Qt::ItemNeverHasChildren set.-
1731-
1732 \sa parent(), index()-
1733*/-
1734bool QAbstractItemModel::hasChildren(const QModelIndex &parent) const-
1735{-
1736 return (rowCount(parent) > 0) && (columnCount(parent) > 0);
executed 2127 times by 5 tests: return (rowCount(parent) > 0) && (columnCount(parent) > 0);
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QSortFilterProxyModel
  • tst_QTreeView
2127
1737}-
1738-
1739/*!-
1740 \fn QModelIndex QAbstractItemModel::sibling(int row, int column, const QModelIndex &index) const-
1741-
1742 Returns the sibling at \a row and \a column for the item at \a index, or an-
1743 invalid QModelIndex if there is no sibling at that location.-
1744-
1745 sibling() is just a convenience function that finds the item's parent, and-
1746 uses it to retrieve the index of the child item in the specified \a row and-
1747 \a column.-
1748-
1749 This method can optionally be overridden for implementation-specific optimization.-
1750-
1751 \sa index(), QModelIndex::row(), QModelIndex::column()-
1752*/-
1753QModelIndex QAbstractItemModel::sibling(int row, int column, const QModelIndex &idx) const-
1754{-
1755 return (row == idx.row() && column == idx.column()) ? idx : index(row, column, parent(idx));
executed 32937 times by 16 tests: return (row == idx.row() && column == idx.column()) ? idx : index(row, column, parent(idx));
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDirModel
  • tst_QItemModel
  • tst_QItemSelectionModel
  • tst_QItemView
  • tst_QStandardItemModel
  • tst_QTableView
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
32937
1756}-
1757-
1758-
1759/*!-
1760 Returns a map with values for all predefined roles in the model for the-
1761 item at the given \a index.-
1762-
1763 Reimplement this function if you want to extend the default behavior of-
1764 this function to include custom roles in the map.-
1765-
1766 \sa Qt::ItemDataRole, data()-
1767*/-
1768QMap<int, QVariant> QAbstractItemModel::itemData(const QModelIndex &index) const-
1769{-
1770 QMap<int, QVariant> roles;-
1771 for (int i = 0; i < Qt::UserRole; ++i) {
i < Qt::UserRoleDescription
TRUEevaluated 116480 times by 6 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 455 times by 6 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
455-116480
1772 QVariant variantData = data(index, i);-
1773 if (variantData.isValid())
variantData.isValid()Description
TRUEevaluated 101145 times by 5 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
FALSEevaluated 15335 times by 5 tests
Evaluated by:
  • tst_ModelTest
  • tst_QAbstractProxyModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
15335-101145
1774 roles.insert(i, variantData);
executed 101145 times by 5 tests: roles.insert(i, variantData);
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
101145
1775 }
executed 116480 times by 6 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
116480
1776 return roles;
executed 455 times by 6 tests: return roles;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QAbstractProxyModel
  • tst_QIdentityProxyModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
455
1777}-
1778-
1779/*!-
1780 Sets the \a role data for the item at \a index to \a value.-
1781-
1782 Returns \c{true} if successful; otherwise returns \c{false}.-
1783-
1784 The dataChanged() signal should be emitted if the data was successfully-
1785 set.-
1786-
1787 The base class implementation returns \c{false}. This function and data() must-
1788 be reimplemented for editable models.-
1789-
1790 \sa Qt::ItemDataRole, data(), itemData()-
1791*/-
1792bool QAbstractItemModel::setData(const QModelIndex &index, const QVariant &value, int role)-
1793{-
1794 Q_UNUSED(index);-
1795 Q_UNUSED(value);-
1796 Q_UNUSED(role);-
1797 return false;
executed 25 times by 3 tests: return false;
Executed by:
  • tst_ModelTest
  • tst_QItemModel
  • tst_QSortFilterProxyModel
25
1798}-
1799-
1800/*!-
1801 \fn QVariant QAbstractItemModel::data(const QModelIndex &index, int role) const = 0-
1802-
1803 Returns the data stored under the given \a role for the item referred to-
1804 by the \a index.-
1805-
1806 \note If you do not have a value to return, return an \b invalid-
1807 QVariant instead of returning 0.-
1808-
1809 \sa Qt::ItemDataRole, setData(), headerData()-
1810*/-
1811-
1812/*!-
1813 Sets the role data for the item at \a index to the associated value in-
1814 \a roles, for every Qt::ItemDataRole.-
1815-
1816 Returns \c{true} if successful; otherwise returns \c{false}.-
1817-
1818 Roles that are not in \a roles will not be modified.-
1819-
1820 \sa setData(), data(), itemData()-
1821*/-
1822bool QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)-
1823{-
1824 bool b = true;-
1825 for (QMap<int, QVariant>::ConstIterator it = roles.begin(); it != roles.end(); ++it)
it != roles.end()Description
TRUEevaluated 11776 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QItemModel
59-11776
1826 b = b && setData(index, it.value(), it.key());
executed 11776 times by 1 test: b = b && setData(index, it.value(), it.key());
Executed by:
  • tst_QAbstractItemModel
bDescription
TRUEevaluated 11776 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEnever evaluated
setData(index,...e(), it.key())Description
TRUEevaluated 11776 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEnever evaluated
0-11776
1827 return b;
executed 59 times by 2 tests: return b;
Executed by:
  • tst_QAbstractItemModel
  • tst_QItemModel
59
1828}-
1829-
1830/*!-
1831 Returns the list of allowed MIME types. By default, the built-in-
1832 models and views use an internal MIME type:-
1833 \c{application/x-qabstractitemmodeldatalist}.-
1834-
1835 When implementing drag and drop support in a custom model, if you-
1836 will return data in formats other than the default internal MIME-
1837 type, reimplement this function to return your list of MIME types.-
1838-
1839 If you reimplement this function in your custom model, you must-
1840 also reimplement the member functions that call it: mimeData() and-
1841 dropMimeData().-
1842-
1843 \sa mimeData(), dropMimeData()-
1844*/-
1845QStringList QAbstractItemModel::mimeTypes() const-
1846{-
1847 QStringList types;-
1848 types << QStringLiteral("application/x-qabstractitemmodeldatalist");
executed 174 times by 7 tests: return qstring_literal_temp;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
174
1849 return types;
executed 174 times by 7 tests: return types;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QListWidget
  • tst_QSortFilterProxyModel
  • tst_QStandardItemModel
  • tst_QTableWidget
174
1850}-
1851-
1852/*!-
1853 Returns an object that contains serialized items of data corresponding to-
1854 the list of \a indexes specified. The format used to describe the encoded-
1855 data is obtained from the mimeTypes() function. This default implementation-
1856 uses the default MIME type returned by the default implementation of-
1857 mimeTypes(). If you reimplement mimeTypes() in your custom model to return-
1858 more MIME types, reimplement this function to make use of them.-
1859-
1860 If the list of \a indexes is empty, or there are no supported MIME types, 0-
1861 is returned rather than a serialized empty list.-
1862-
1863 \sa mimeTypes(), dropMimeData()-
1864*/-
1865QMimeData *QAbstractItemModel::mimeData(const QModelIndexList &indexes) const-
1866{-
1867 if (indexes.count() <= 0)
indexes.count() <= 0Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QListWidget
  • tst_QTableWidget
FALSEevaluated 28 times by 4 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
8-28
1868 return 0;
executed 8 times by 2 tests: return 0;
Executed by:
  • tst_QListWidget
  • tst_QTableWidget
8
1869 QStringList types = mimeTypes();-
1870 if (types.isEmpty())
types.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 28 times by 4 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
0-28
1871 return 0;
never executed: return 0;
0
1872 QMimeData *data = new QMimeData();-
1873 QString format = types.at(0);-
1874 QByteArray encoded;-
1875 QDataStream stream(&encoded, QIODevice::WriteOnly);-
1876 encodeData(indexes, stream);-
1877 data->setData(format, encoded);-
1878 return data;
executed 28 times by 4 tests: return data;
Executed by:
  • tst_QAbstractItemModel
  • tst_QListWidget
  • tst_QStandardItemModel
  • tst_QTableWidget
28
1879}-
1880-
1881/*!-
1882 Returns \c{true} if a model can accept a drop of the \a data. This-
1883 default implementation only checks if \a data has at least one format-
1884 in the list of mimeTypes() and if \a action is among the-
1885 model's supportedDropActions().-
1886-
1887 Reimplement this function in your custom model, if you want to-
1888 test whether the \a data can be dropped at \a row, \a column,-
1889 \a parent with \a action. If you don't need that test, it is not-
1890 necessary to reimplement this function.-
1891-
1892 \sa dropMimeData(), {Using drag and drop with item views}-
1893 */-
1894bool QAbstractItemModel::canDropMimeData(const QMimeData *data, Qt::DropAction action,-
1895 int row, int column,-
1896 const QModelIndex &parent) const-
1897{-
1898 Q_UNUSED(row)-
1899 Q_UNUSED(column)-
1900 Q_UNUSED(parent)-
1901-
1902 if (!(action & supportedDropActions()))
!(action & sup...DropActions())Description
TRUEnever evaluated
FALSEnever evaluated
0
1903 return false;
never executed: return false;
0
1904-
1905 const QStringList modelTypes = mimeTypes();-
1906 for (int i = 0; i < modelTypes.count(); ++i) {
i < modelTypes.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
1907 if (data->hasFormat(modelTypes.at(i)))
data->hasForma...elTypes.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
0
1908 return true;
never executed: return true;
0
1909 }
never executed: end of block
0
1910 return false;
never executed: return false;
0
1911}-
1912-
1913/*!-
1914 Handles the \a data supplied by a drag and drop operation that ended with-
1915 the given \a action.-
1916-
1917 Returns \c{true} if the data and action were handled by the model; otherwise-
1918 returns \c{false}.-
1919-
1920 The specified \a row, \a column and \a parent indicate the location of an-
1921 item in the model where the operation ended. It is the responsibility of-
1922 the model to complete the action at the correct location.-
1923-
1924 For instance, a drop action on an item in a QTreeView can result in new-
1925 items either being inserted as children of the item specified by \a row,-
1926 \a column, and \a parent, or as siblings of the item.-
1927-
1928 When \a row and \a column are -1 it means that the dropped data should be-
1929 considered as dropped directly on \a parent. Usually this will mean-
1930 appending the data as child items of \a parent. If \a row and \a column are-
1931 greater than or equal zero, it means that the drop occurred just before the-
1932 specified \a row and \a column in the specified \a parent.-
1933-
1934 The mimeTypes() member is called to get the list of acceptable MIME types.-
1935 This default implementation assumes the default implementation of mimeTypes(),-
1936 which returns a single default MIME type. If you reimplement mimeTypes() in-
1937 your custom model to return multiple MIME types, you must reimplement this-
1938 function to make use of them.-
1939-
1940 \sa supportedDropActions(), canDropMimeData(), {Using drag and drop with item views}-
1941*/-
1942bool QAbstractItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,-
1943 int row, int column, const QModelIndex &parent)-
1944{-
1945 // check if the action is supported-
1946 if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction))
!dataDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
action == Qt::CopyActionDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEnever evaluated
action == Qt::MoveActionDescription
TRUEnever evaluated
FALSEnever evaluated
0-12
1947 return false;
never executed: return false;
0
1948 // check if the format is supported-
1949 QStringList types = mimeTypes();-
1950 if (types.isEmpty())
types.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
0-12
1951 return false;
never executed: return false;
0
1952 QString format = types.at(0);-
1953 if (!data->hasFormat(format))
!data->hasFormat(format)Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
0-12
1954 return false;
never executed: return false;
0
1955 if (row > rowCount(parent))
row > rowCount(parent)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
4-8
1956 row = rowCount(parent);
executed 4 times by 1 test: row = rowCount(parent);
Executed by:
  • tst_QAbstractItemModel
4
1957 if (row == -1)
row == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
0-12
1958 row = rowCount(parent);
never executed: row = rowCount(parent);
0
1959 if (column == -1)
column == -1Description
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QAbstractItemModel
0-12
1960 column = 0;
never executed: column = 0;
0
1961 // decode and insert-
1962 QByteArray encoded = data->data(format);-
1963 QDataStream stream(&encoded, QIODevice::ReadOnly);-
1964 return decodeData(row, column, parent, stream);
executed 12 times by 1 test: return decodeData(row, column, parent, stream);
Executed by:
  • tst_QAbstractItemModel
12
1965}-
1966-
1967/*!-
1968 \since 4.2-
1969-
1970 Returns the drop actions supported by this model.-
1971-
1972 The default implementation returns Qt::CopyAction. Reimplement this-
1973 function if you wish to support additional actions. You must also-
1974 reimplement the dropMimeData() function to handle the additional-
1975 operations.-
1976-
1977 \sa dropMimeData(), Qt::DropActions, {Using drag and drop with item-
1978 views}-
1979*/-
1980Qt::DropActions QAbstractItemModel::supportedDropActions() const-
1981{-
1982 return Qt::CopyAction;
executed 91 times by 4 tests: return Qt::CopyAction;
Executed by:
  • tst_ModelTest
  • tst_QAbstractItemModel
  • tst_QItemModel
  • tst_QSortFilterProxyModel
91
1983}-
1984-
1985/*!-
1986 Returns the actions supported by the data in this model.-
1987-
1988 The default implementation returns supportedDropActions(). Reimplement-
1989 this function if you wish to support additional actions.-
1990-
1991 supportedDragActions() is used by QAbstractItemView::startDrag() as the-
1992 default values when a drag occurs.-
1993-
1994 \sa Qt::DropActions, {Using drag and drop with item views}-
1995*/-
1996Qt::DropActions QAbstractItemModel::supportedDragActions() const-
1997{-
1998 Q_D(const QAbstractItemModel);-
1999 if (d->supportedDragActions != -1)
d->supportedDragActions != -1Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAbstractItemModel
0-1
2000 return d->supportedDragActions;
never executed: return d->supportedDragActions;
0
2001 return supportedDropActions();
executed 1 time by 1 test: return supportedDropActions();
Executed by:
  • tst_QAbstractItemModel
1
2002}-
2003-
2004/*!-
2005 \internal-
2006 */-
2007void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions)-
2008{-
2009 Q_D(QAbstractItemModel);-
2010 d->supportedDragActions = actions;-
2011}
never executed: end of block
0
2012-
2013/*!-
2014 \since 4.2-
2015 \obsolete-
2016 \fn void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)-
2017-
2018 This function is obsolete. Reimplement supportedDragActions() instead.-
2019-
2020 Sets the supported drag \a actions for the items in the model.-
2021-
2022 \sa supportedDragActions(), {Using drag and drop with item views}-
2023*/-
2024-
2025/*!-
2026 \note The base class implementation of this function does nothing and-
2027 returns \c{false}.-
2028-
2029 On models that support this, inserts \a count rows into the model before-
2030 the given \a row. Items in the new row will be children of the item-
2031 represented by the \a parent model index.-
2032-
2033 If \a row is 0, the rows are prepended to any existing rows in the parent.-
2034-
2035 If \a row is rowCount(), the rows are appended to any existing rows in the-
2036 parent.-
2037-
2038 If \a parent has no children, a single column with \a count rows is-
2039 inserted.-
2040-
2041 Returns \c{true} if the rows were successfully inserted; otherwise returns-
2042 \c{false}.-
2043-
2044 If you implement your own model, you can reimplement this function if you-
2045 want to support insertions. Alternatively, you can provide your own API for-
2046 altering the data. In either case, you will need to call-
2047 beginInsertRows() and endInsertRows() to notify other components that the-
2048 model has changed.-
2049-
2050 \sa insertColumns(), removeRows(), beginInsertRows(), endInsertRows()-
2051*/-
2052bool QAbstractItemModel::insertRows(int, int, const QModelIndex &)-
2053{-
2054 return false;
never executed: return false;
0
2055}-
2056-
2057/*!-
2058 On models that support this, inserts \a count new columns into the model-
2059 before the given \a column. The items in each new column will be children-
2060 of the item represented by the \a parent model index.-
2061-
2062 If \a column is 0, the columns are prepended to any existing columns.-
2063-
2064 If \a column is columnCount(), the columns are appended to any existing-
2065 columns.-
2066-
2067 If \a parent has no children, a single row with \a count columns is-
2068 inserted.-
2069-
2070 Returns \c{true} if the columns were successfully inserted; otherwise returns-
2071 \c{false}.-
2072-
2073 The base class implementation does nothing and returns \c{false}.-
2074-
2075 If you implement your own model, you can reimplement this function if you-
2076 want to support insertions. Alternatively, you can provide your own API for-
2077 altering the data.-
2078-
2079 \sa insertRows(), removeColumns(), beginInsertColumns(), endInsertColumns()-
2080*/-
2081bool QAbstractItemModel::insertColumns(int, int, const QModelIndex &)-
2082{-