| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qlistwidget.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | typedef bool(*LessThan)(const QPair<QListWidgetItem*,int>&,const QPair<QListWidgetItem*,int>&); | - | ||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | class QListWidgetMimeData : public QMimeData | - | ||||||||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||||||||
| 13 | public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } | - | ||||||||||||||||||||||||||||||
| 14 | #pragma GCC diagnostic push | - | ||||||||||||||||||||||||||||||
| 15 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||||||||||||||
| 16 | #pragma GCC diagnostic pop | - | ||||||||||||||||||||||||||||||
| 17 | struct QPrivateSignal {}; | - | ||||||||||||||||||||||||||||||
| 18 | public: | - | ||||||||||||||||||||||||||||||
| 19 | QList<QListWidgetItem*> items; | - | ||||||||||||||||||||||||||||||
| 20 | }; | - | ||||||||||||||||||||||||||||||
| 21 | - | |||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||
| 25 | QListModel::QListModel(QListWidget *parent) | - | ||||||||||||||||||||||||||||||
| 26 | : QAbstractListModel(parent) | - | ||||||||||||||||||||||||||||||
| 27 | { | - | ||||||||||||||||||||||||||||||
| 28 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 29 | - | |||||||||||||||||||||||||||||||
| 30 | QListModel::~QListModel() | - | ||||||||||||||||||||||||||||||
| 31 | { | - | ||||||||||||||||||||||||||||||
| 32 | clear(); | - | ||||||||||||||||||||||||||||||
| 33 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||
| 35 | void QListModel::clear() | - | ||||||||||||||||||||||||||||||
| 36 | { | - | ||||||||||||||||||||||||||||||
| 37 | beginResetModel(); | - | ||||||||||||||||||||||||||||||
| 38 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 39 | if (items.at(i)
| 0 | ||||||||||||||||||||||||||||||
| 40 | items.at(i)->d->theid = -1; | - | ||||||||||||||||||||||||||||||
| 41 | items.at(i)->view = 0; | - | ||||||||||||||||||||||||||||||
| 42 | delete items.at(i); | - | ||||||||||||||||||||||||||||||
| 43 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 44 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 45 | items.clear(); | - | ||||||||||||||||||||||||||||||
| 46 | endResetModel(); | - | ||||||||||||||||||||||||||||||
| 47 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||||||||
| 49 | QListWidgetItem *QListModel::at(int row) const | - | ||||||||||||||||||||||||||||||
| 50 | { | - | ||||||||||||||||||||||||||||||
| 51 | return never executed: items.value(row);return items.value(row);never executed: return items.value(row); | 0 | ||||||||||||||||||||||||||||||
| 52 | } | - | ||||||||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||||||||
| 54 | void QListModel::remove(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 55 | { | - | ||||||||||||||||||||||||||||||
| 56 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 57 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 58 | int row = items.indexOf(item); | - | ||||||||||||||||||||||||||||||
| 59 | ((!(row != -1)) ? qt_assert("row != -1",__FILE__,100) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 60 | beginRemoveRows(QModelIndex(), row, row); | - | ||||||||||||||||||||||||||||||
| 61 | items.at(row)->d->theid = -1; | - | ||||||||||||||||||||||||||||||
| 62 | items.at(row)->view = 0; | - | ||||||||||||||||||||||||||||||
| 63 | items.removeAt(row); | - | ||||||||||||||||||||||||||||||
| 64 | endRemoveRows(); | - | ||||||||||||||||||||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||
| 67 | void QListModel::insert(int row, QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 68 | { | - | ||||||||||||||||||||||||||||||
| 69 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 70 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 71 | - | |||||||||||||||||||||||||||||||
| 72 | item->view = qobject_cast<QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 73 | if (item->view
| 0 | ||||||||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||||||||
| 75 | QList<QListWidgetItem*>::iterator it; | - | ||||||||||||||||||||||||||||||
| 76 | it = sortedInsertionIterator(items.begin(), items.end(), | - | ||||||||||||||||||||||||||||||
| 77 | item->view->sortOrder(), item); | - | ||||||||||||||||||||||||||||||
| 78 | row = qMax(it - items.begin(), 0); | - | ||||||||||||||||||||||||||||||
| 79 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 80 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||
| 81 | row = 0; never executed: row = 0; | 0 | ||||||||||||||||||||||||||||||
| 82 | else if (row > items.count()
| 0 | ||||||||||||||||||||||||||||||
| 83 | row = items.count(); never executed: row = items.count(); | 0 | ||||||||||||||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 85 | beginInsertRows(QModelIndex(), row, row); | - | ||||||||||||||||||||||||||||||
| 86 | items.insert(row, item); | - | ||||||||||||||||||||||||||||||
| 87 | item->d->theid = row; | - | ||||||||||||||||||||||||||||||
| 88 | endInsertRows(); | - | ||||||||||||||||||||||||||||||
| 89 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||||||||
| 91 | void QListModel::insert(int row, const QStringList &labels) | - | ||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||
| 93 | const int count = labels.count(); | - | ||||||||||||||||||||||||||||||
| 94 | if (count <= 0
| 0 | ||||||||||||||||||||||||||||||
| 95 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 96 | QListWidget *view = qobject_cast<QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 97 | if (view
| 0 | ||||||||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||||||||
| 99 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 100 | QListWidgetItem *item = new QListWidgetItem(labels.at(i)); | - | ||||||||||||||||||||||||||||||
| 101 | insert(row, item); | - | ||||||||||||||||||||||||||||||
| 102 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 103 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 104 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||
| 105 | row = 0; never executed: row = 0; | 0 | ||||||||||||||||||||||||||||||
| 106 | else if (row > items.count()
| 0 | ||||||||||||||||||||||||||||||
| 107 | row = items.count(); never executed: row = items.count(); | 0 | ||||||||||||||||||||||||||||||
| 108 | beginInsertRows(QModelIndex(), row, row + count - 1); | - | ||||||||||||||||||||||||||||||
| 109 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 110 | QListWidgetItem *item = new QListWidgetItem(labels.at(i)); | - | ||||||||||||||||||||||||||||||
| 111 | item->d->theid = row; | - | ||||||||||||||||||||||||||||||
| 112 | item->view = qobject_cast<QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 113 | items.insert(row++, item); | - | ||||||||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 115 | endInsertRows(); | - | ||||||||||||||||||||||||||||||
| 116 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 117 | } | - | ||||||||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||||||||
| 119 | QListWidgetItem *QListModel::take(int row) | - | ||||||||||||||||||||||||||||||
| 120 | { | - | ||||||||||||||||||||||||||||||
| 121 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||
| 122 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||
| 124 | beginRemoveRows(QModelIndex(), row, row); | - | ||||||||||||||||||||||||||||||
| 125 | items.at(row)->d->theid = -1; | - | ||||||||||||||||||||||||||||||
| 126 | items.at(row)->view = 0; | - | ||||||||||||||||||||||||||||||
| 127 | QListWidgetItem *item = items.takeAt(row); | - | ||||||||||||||||||||||||||||||
| 128 | endRemoveRows(); | - | ||||||||||||||||||||||||||||||
| 129 | return never executed: item;return item;never executed: return item; | 0 | ||||||||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||
| 132 | void QListModel::move(int srcRow, int dstRow) | - | ||||||||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||||||||
| 134 | if (srcRow == dstRow
| 0 | ||||||||||||||||||||||||||||||
| 135 | || srcRow < 0
| 0 | ||||||||||||||||||||||||||||||
| 136 | || dstRow < 0
| 0 | ||||||||||||||||||||||||||||||
| 137 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||
| 139 | if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow)
| 0 | ||||||||||||||||||||||||||||||
| 140 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 141 | if (srcRow < dstRow
| 0 | ||||||||||||||||||||||||||||||
| 142 | -- never executed: dstRow;--dstRow;never executed: --dstRow; | 0 | ||||||||||||||||||||||||||||||
| 143 | items.move(srcRow, dstRow); | - | ||||||||||||||||||||||||||||||
| 144 | endMoveRows(); | - | ||||||||||||||||||||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | int QListModel::rowCount(const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||||||||
| 149 | return never executed: parent.isValid() ? 0 : items.count();return parent.isValid() ? 0 : items.count();never executed: return parent.isValid() ? 0 : items.count(); | 0 | ||||||||||||||||||||||||||||||
| 150 | } | - | ||||||||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||||||||
| 152 | QModelIndex QListModel::index(QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||||||||
| 154 | if (!item
| 0 | ||||||||||||||||||||||||||||||
| 155 | || items.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 156 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||
| 157 | int row; | - | ||||||||||||||||||||||||||||||
| 158 | const int theid = item->d->theid; | - | ||||||||||||||||||||||||||||||
| 159 | if (theid >= 0
| 0 | ||||||||||||||||||||||||||||||
| 160 | row = theid; | - | ||||||||||||||||||||||||||||||
| 161 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 162 | row = items.lastIndexOf(item); | - | ||||||||||||||||||||||||||||||
| 163 | if (row == -1
| 0 | ||||||||||||||||||||||||||||||
| 164 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||
| 165 | item->d->theid = row; | - | ||||||||||||||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 167 | return never executed: createIndex(row, 0, item);return createIndex(row, 0, item);never executed: return createIndex(row, 0, item); | 0 | ||||||||||||||||||||||||||||||
| 168 | } | - | ||||||||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||||||||
| 170 | QModelIndex QListModel::index(int row, int column, const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||
| 171 | { | - | ||||||||||||||||||||||||||||||
| 172 | if (hasIndex(row, column, parent)
| 0 | ||||||||||||||||||||||||||||||
| 173 | return never executed: createIndex(row, column, items.at(row));return createIndex(row, column, items.at(row));never executed: return createIndex(row, column, items.at(row)); | 0 | ||||||||||||||||||||||||||||||
| 174 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||
| 175 | } | - | ||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||
| 177 | QVariant QListModel::data(const QModelIndex &index, int role) const | - | ||||||||||||||||||||||||||||||
| 178 | { | - | ||||||||||||||||||||||||||||||
| 179 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 180 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||
| 181 | return never executed: items.at(index.row())->data(role);return items.at(index.row())->data(role);never executed: return items.at(index.row())->data(role); | 0 | ||||||||||||||||||||||||||||||
| 182 | } | - | ||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||
| 184 | bool QListModel::setData(const QModelIndex &index, const QVariant &value, int role) | - | ||||||||||||||||||||||||||||||
| 185 | { | - | ||||||||||||||||||||||||||||||
| 186 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 187 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 188 | items.at(index.row())->setData(role, value); | - | ||||||||||||||||||||||||||||||
| 189 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 190 | } | - | ||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||
| 192 | QMap<int, QVariant> QListModel::itemData(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||
| 193 | { | - | ||||||||||||||||||||||||||||||
| 194 | QMap<int, QVariant> roles; | - | ||||||||||||||||||||||||||||||
| 195 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 196 | return never executed: roles;return roles;never executed: return roles; | 0 | ||||||||||||||||||||||||||||||
| 197 | QListWidgetItem *itm = items.at(index.row()); | - | ||||||||||||||||||||||||||||||
| 198 | for (int i = 0; i < itm->d->values.count()
| 0 | ||||||||||||||||||||||||||||||
| 199 | roles.insert(itm->d->values.at(i).role, | - | ||||||||||||||||||||||||||||||
| 200 | itm->d->values.at(i).value); | - | ||||||||||||||||||||||||||||||
| 201 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 202 | return never executed: roles;return roles;never executed: return roles; | 0 | ||||||||||||||||||||||||||||||
| 203 | } | - | ||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||
| 205 | bool QListModel::insertRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||||||||
| 207 | if (count < 1
| 0 | ||||||||||||||||||||||||||||||
| 208 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||||||||
| 210 | beginInsertRows(QModelIndex(), row, row + count - 1); | - | ||||||||||||||||||||||||||||||
| 211 | QListWidget *view = qobject_cast<QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 212 | QListWidgetItem *itm = 0; | - | ||||||||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||||||||
| 214 | for (int r = row; r < row + count
| 0 | ||||||||||||||||||||||||||||||
| 215 | itm = new QListWidgetItem; | - | ||||||||||||||||||||||||||||||
| 216 | itm->view = view; | - | ||||||||||||||||||||||||||||||
| 217 | itm->d->theid = r; | - | ||||||||||||||||||||||||||||||
| 218 | items.insert(r, itm); | - | ||||||||||||||||||||||||||||||
| 219 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||
| 221 | endInsertRows(); | - | ||||||||||||||||||||||||||||||
| 222 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 223 | } | - | ||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||
| 225 | bool QListModel::removeRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||
| 226 | { | - | ||||||||||||||||||||||||||||||
| 227 | if (count < 1
| 0 | ||||||||||||||||||||||||||||||
| 228 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||||||||
| 230 | beginRemoveRows(QModelIndex(), row, row + count - 1); | - | ||||||||||||||||||||||||||||||
| 231 | QListWidgetItem *itm = 0; | - | ||||||||||||||||||||||||||||||
| 232 | for (int r = row; r < row + count
| 0 | ||||||||||||||||||||||||||||||
| 233 | itm = items.takeAt(row); | - | ||||||||||||||||||||||||||||||
| 234 | itm->view = 0; | - | ||||||||||||||||||||||||||||||
| 235 | itm->d->theid = -1; | - | ||||||||||||||||||||||||||||||
| 236 | delete itm; | - | ||||||||||||||||||||||||||||||
| 237 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 238 | endRemoveRows(); | - | ||||||||||||||||||||||||||||||
| 239 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 240 | } | - | ||||||||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||||||||
| 242 | Qt::ItemFlags QListModel::flags(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||||||||
| 244 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 245 | return never executed: Qt::ItemIsDropEnabled;return Qt::ItemIsDropEnabled;never executed: return Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||
| 246 | return never executed: items.at(index.row())->flags();return items.at(index.row())->flags();never executed: return items.at(index.row())->flags(); | 0 | ||||||||||||||||||||||||||||||
| 247 | } | - | ||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||
| 249 | void QListModel::sort(int column, Qt::SortOrder order) | - | ||||||||||||||||||||||||||||||
| 250 | { | - | ||||||||||||||||||||||||||||||
| 251 | if (column != 0
| 0 | ||||||||||||||||||||||||||||||
| 252 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 253 | - | |||||||||||||||||||||||||||||||
| 254 | layoutAboutToBeChanged(); | - | ||||||||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||||||||
| 256 | QVector < QPair<QListWidgetItem*,int> > sorting(items.count()); | - | ||||||||||||||||||||||||||||||
| 257 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||
| 258 | QListWidgetItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||
| 259 | sorting[i].first = item; | - | ||||||||||||||||||||||||||||||
| 260 | sorting[i].second = i; | - | ||||||||||||||||||||||||||||||
| 261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||||||||
| 263 | LessThan compare = (order == Qt::AscendingOrder
| 0 | ||||||||||||||||||||||||||||||
| 264 | std::sort(sorting.begin(), sorting.end(), compare); | - | ||||||||||||||||||||||||||||||
| 265 | QModelIndexList fromIndexes; | - | ||||||||||||||||||||||||||||||
| 266 | QModelIndexList toIndexes; | - | ||||||||||||||||||||||||||||||
| 267 | const int sortingCount = sorting.count(); | - | ||||||||||||||||||||||||||||||
| 268 | fromIndexes.reserve(sortingCount); | - | ||||||||||||||||||||||||||||||
| 269 | toIndexes.reserve(sortingCount); | - | ||||||||||||||||||||||||||||||
| 270 | for (int r = 0; r < sortingCount
| 0 | ||||||||||||||||||||||||||||||
| 271 | QListWidgetItem *item = sorting.at(r).first; | - | ||||||||||||||||||||||||||||||
| 272 | toIndexes.append(createIndex(r, 0, item)); | - | ||||||||||||||||||||||||||||||
| 273 | fromIndexes.append(createIndex(sorting.at(r).second, 0, sorting.at(r).first)); | - | ||||||||||||||||||||||||||||||
| 274 | items[r] = sorting.at(r).first; | - | ||||||||||||||||||||||||||||||
| 275 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 276 | changePersistentIndexList(fromIndexes, toIndexes); | - | ||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | layoutChanged(); | - | ||||||||||||||||||||||||||||||
| 279 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 280 | void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int end) | - | ||||||||||||||||||||||||||||||
| 281 | { | - | ||||||||||||||||||||||||||||||
| 282 | if (column != 0
| 0 | ||||||||||||||||||||||||||||||
| 283 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||
| 285 | int count = end - start + 1; | - | ||||||||||||||||||||||||||||||
| 286 | QVector < QPair<QListWidgetItem*,int> > sorting(count); | - | ||||||||||||||||||||||||||||||
| 287 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 288 | sorting[i].first = items.at(start + i); | - | ||||||||||||||||||||||||||||||
| 289 | sorting[i].second = start + i; | - | ||||||||||||||||||||||||||||||
| 290 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||
| 292 | LessThan compare = (order == Qt::AscendingOrder
| 0 | ||||||||||||||||||||||||||||||
| 293 | std::sort(sorting.begin(), sorting.end(), compare); | - | ||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||
| 295 | QModelIndexList oldPersistentIndexes = persistentIndexList(); | - | ||||||||||||||||||||||||||||||
| 296 | QModelIndexList newPersistentIndexes = oldPersistentIndexes; | - | ||||||||||||||||||||||||||||||
| 297 | QList<QListWidgetItem*> tmp = items; | - | ||||||||||||||||||||||||||||||
| 298 | QList<QListWidgetItem*>::iterator lit = tmp.begin(); | - | ||||||||||||||||||||||||||||||
| 299 | bool changed = false; | - | ||||||||||||||||||||||||||||||
| 300 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 301 | int oldRow = sorting.at(i).second; | - | ||||||||||||||||||||||||||||||
| 302 | int tmpitepos = lit - tmp.begin(); | - | ||||||||||||||||||||||||||||||
| 303 | QListWidgetItem *item = tmp.takeAt(oldRow); | - | ||||||||||||||||||||||||||||||
| 304 | if (tmpitepos > tmp.size()
| 0 | ||||||||||||||||||||||||||||||
| 305 | -- never executed: tmpitepos;--tmpitepos;never executed: --tmpitepos; | 0 | ||||||||||||||||||||||||||||||
| 306 | lit = tmp.begin() + tmpitepos; | - | ||||||||||||||||||||||||||||||
| 307 | lit = sortedInsertionIterator(lit, tmp.end(), order, item); | - | ||||||||||||||||||||||||||||||
| 308 | int newRow = qMax(lit - tmp.begin(), 0); | - | ||||||||||||||||||||||||||||||
| 309 | lit = tmp.insert(lit, item); | - | ||||||||||||||||||||||||||||||
| 310 | if (newRow != oldRow
| 0 | ||||||||||||||||||||||||||||||
| 311 | changed = true; | - | ||||||||||||||||||||||||||||||
| 312 | for (int j = i + 1; j < count
| 0 | ||||||||||||||||||||||||||||||
| 313 | int otherRow = sorting.at(j).second; | - | ||||||||||||||||||||||||||||||
| 314 | if (oldRow < otherRow
| 0 | ||||||||||||||||||||||||||||||
| 315 | -- never executed: sorting[j].second;--sorting[j].second;never executed: --sorting[j].second; | 0 | ||||||||||||||||||||||||||||||
| 316 | else if (oldRow > otherRow
| 0 | ||||||||||||||||||||||||||||||
| 317 | ++ never executed: sorting[j].second;++sorting[j].second;never executed: ++sorting[j].second; | 0 | ||||||||||||||||||||||||||||||
| 318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 319 | for (int k = 0; k < newPersistentIndexes.count()
| 0 | ||||||||||||||||||||||||||||||
| 320 | QModelIndex pi = newPersistentIndexes.at(k); | - | ||||||||||||||||||||||||||||||
| 321 | int oldPersistentRow = pi.row(); | - | ||||||||||||||||||||||||||||||
| 322 | int newPersistentRow = oldPersistentRow; | - | ||||||||||||||||||||||||||||||
| 323 | if (oldPersistentRow == oldRow
| 0 | ||||||||||||||||||||||||||||||
| 324 | newPersistentRow = newRow; never executed: newPersistentRow = newRow; | 0 | ||||||||||||||||||||||||||||||
| 325 | else if (oldRow < oldPersistentRow
| 0 | ||||||||||||||||||||||||||||||
| 326 | newPersistentRow = oldPersistentRow - 1; never executed: newPersistentRow = oldPersistentRow - 1; | 0 | ||||||||||||||||||||||||||||||
| 327 | else if (oldRow > oldPersistentRow
| 0 | ||||||||||||||||||||||||||||||
| 328 | newPersistentRow = oldPersistentRow + 1; never executed: newPersistentRow = oldPersistentRow + 1; | 0 | ||||||||||||||||||||||||||||||
| 329 | if (newPersistentRow != oldPersistentRow
| 0 | ||||||||||||||||||||||||||||||
| 330 | newPersistentIndexes[k] = createIndex(newPersistentRow, never executed: newPersistentIndexes[k] = createIndex(newPersistentRow, pi.column(), pi.internalPointer()); | 0 | ||||||||||||||||||||||||||||||
| 331 | pi.column(), pi.internalPointer()); never executed: newPersistentIndexes[k] = createIndex(newPersistentRow, pi.column(), pi.internalPointer()); | 0 | ||||||||||||||||||||||||||||||
| 332 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 333 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||
| 336 | if (changed
| 0 | ||||||||||||||||||||||||||||||
| 337 | layoutAboutToBeChanged(); | - | ||||||||||||||||||||||||||||||
| 338 | items = tmp; | - | ||||||||||||||||||||||||||||||
| 339 | changePersistentIndexList(oldPersistentIndexes, newPersistentIndexes); | - | ||||||||||||||||||||||||||||||
| 340 | layoutChanged(); | - | ||||||||||||||||||||||||||||||
| 341 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 342 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||
| 344 | bool QListModel::itemLessThan(const QPair<QListWidgetItem*,int> &left, | - | ||||||||||||||||||||||||||||||
| 345 | const QPair<QListWidgetItem*,int> &right) | - | ||||||||||||||||||||||||||||||
| 346 | { | - | ||||||||||||||||||||||||||||||
| 347 | return never executed: (*left.first) < (*right.first);return (*left.first) < (*right.first);never executed: return (*left.first) < (*right.first); | 0 | ||||||||||||||||||||||||||||||
| 348 | } | - | ||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||
| 350 | bool QListModel::itemGreaterThan(const QPair<QListWidgetItem*,int> &left, | - | ||||||||||||||||||||||||||||||
| 351 | const QPair<QListWidgetItem*,int> &right) | - | ||||||||||||||||||||||||||||||
| 352 | { | - | ||||||||||||||||||||||||||||||
| 353 | return never executed: (*right.first) < (*left.first);return (*right.first) < (*left.first);never executed: return (*right.first) < (*left.first); | 0 | ||||||||||||||||||||||||||||||
| 354 | } | - | ||||||||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||||||||
| 356 | QList<QListWidgetItem*>::iterator QListModel::sortedInsertionIterator( | - | ||||||||||||||||||||||||||||||
| 357 | const QList<QListWidgetItem*>::iterator &begin, | - | ||||||||||||||||||||||||||||||
| 358 | const QList<QListWidgetItem*>::iterator &end, | - | ||||||||||||||||||||||||||||||
| 359 | Qt::SortOrder order, QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||||||||
| 361 | if (order == Qt::AscendingOrder
| 0 | ||||||||||||||||||||||||||||||
| 362 | return never executed: std::lower_bound(begin, end, item, QListModelLessThan());return std::lower_bound(begin, end, item, QListModelLessThan());never executed: return std::lower_bound(begin, end, item, QListModelLessThan()); | 0 | ||||||||||||||||||||||||||||||
| 363 | return never executed: std::lower_bound(begin, end, item, QListModelGreaterThan());return std::lower_bound(begin, end, item, QListModelGreaterThan());never executed: return std::lower_bound(begin, end, item, QListModelGreaterThan()); | 0 | ||||||||||||||||||||||||||||||
| 364 | } | - | ||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | void QListModel::itemChanged(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||||||||
| 368 | QModelIndex idx = index(item); | - | ||||||||||||||||||||||||||||||
| 369 | dataChanged(idx, idx); | - | ||||||||||||||||||||||||||||||
| 370 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||
| 372 | QStringList QListModel::mimeTypes() const | - | ||||||||||||||||||||||||||||||
| 373 | { | - | ||||||||||||||||||||||||||||||
| 374 | const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 375 | return never executed: view->mimeTypes();return view->mimeTypes();never executed: return view->mimeTypes(); | 0 | ||||||||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||
| 378 | QMimeData *QListModel::internalMimeData() const | - | ||||||||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||||||||
| 380 | return never executed: QAbstractItemModel::mimeData(cachedIndexes);return QAbstractItemModel::mimeData(cachedIndexes);never executed: return QAbstractItemModel::mimeData(cachedIndexes); | 0 | ||||||||||||||||||||||||||||||
| 381 | } | - | ||||||||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||||||||
| 383 | QMimeData *QListModel::mimeData(const QModelIndexList &indexes) const | - | ||||||||||||||||||||||||||||||
| 384 | { | - | ||||||||||||||||||||||||||||||
| 385 | QList<QListWidgetItem*> itemlist; | - | ||||||||||||||||||||||||||||||
| 386 | const int indexesCount = indexes.count(); | - | ||||||||||||||||||||||||||||||
| 387 | itemlist.reserve(indexesCount); | - | ||||||||||||||||||||||||||||||
| 388 | for (int i = 0; i < indexesCount
| 0 | ||||||||||||||||||||||||||||||
| 389 | itemlist << at(indexes.at(i).row()); never executed: itemlist << at(indexes.at(i).row()); | 0 | ||||||||||||||||||||||||||||||
| 390 | const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||||||||
| 392 | cachedIndexes = indexes; | - | ||||||||||||||||||||||||||||||
| 393 | QMimeData *mimeData = view->mimeData(itemlist); | - | ||||||||||||||||||||||||||||||
| 394 | cachedIndexes.clear(); | - | ||||||||||||||||||||||||||||||
| 395 | return never executed: mimeData;return mimeData;never executed: return mimeData; | 0 | ||||||||||||||||||||||||||||||
| 396 | } | - | ||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||
| 399 | bool QListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - | ||||||||||||||||||||||||||||||
| 400 | int row, int column, const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 401 | { | - | ||||||||||||||||||||||||||||||
| 402 | (void)column;; | - | ||||||||||||||||||||||||||||||
| 403 | QListWidget *view = qobject_cast<QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 404 | if (index.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 405 | row = index.row(); never executed: row = index.row(); | 0 | ||||||||||||||||||||||||||||||
| 406 | else if (row == -1
| 0 | ||||||||||||||||||||||||||||||
| 407 | row = items.count(); never executed: row = items.count(); | 0 | ||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||
| 409 | return never executed: view->dropMimeData(row, data, action);return view->dropMimeData(row, data, action);never executed: return view->dropMimeData(row, data, action); | 0 | ||||||||||||||||||||||||||||||
| 410 | } | - | ||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||
| 412 | Qt::DropActions QListModel::supportedDropActions() const | - | ||||||||||||||||||||||||||||||
| 413 | { | - | ||||||||||||||||||||||||||||||
| 414 | const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent()); | - | ||||||||||||||||||||||||||||||
| 415 | return never executed: view->supportedDropActions();return view->supportedDropActions();never executed: return view->supportedDropActions(); | 0 | ||||||||||||||||||||||||||||||
| 416 | } | - | ||||||||||||||||||||||||||||||
| 417 | QListWidgetItem::QListWidgetItem(QListWidget *view, int type) | - | ||||||||||||||||||||||||||||||
| 418 | : rtti(type), view(view), d(new QListWidgetItemPrivate(this)), | - | ||||||||||||||||||||||||||||||
| 419 | itemFlags(Qt::ItemIsSelectable | - | ||||||||||||||||||||||||||||||
| 420 | |Qt::ItemIsUserCheckable | - | ||||||||||||||||||||||||||||||
| 421 | |Qt::ItemIsEnabled | - | ||||||||||||||||||||||||||||||
| 422 | |Qt::ItemIsDragEnabled) | - | ||||||||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||||||||
| 424 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 425 | model->insert(model->rowCount(), this); never executed: model->insert(model->rowCount(), this); | 0 | ||||||||||||||||||||||||||||||
| 426 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 427 | QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *view, int type) | - | ||||||||||||||||||||||||||||||
| 428 | : rtti(type), view(0), d(new QListWidgetItemPrivate(this)), | - | ||||||||||||||||||||||||||||||
| 429 | itemFlags(Qt::ItemIsSelectable | - | ||||||||||||||||||||||||||||||
| 430 | |Qt::ItemIsUserCheckable | - | ||||||||||||||||||||||||||||||
| 431 | |Qt::ItemIsEnabled | - | ||||||||||||||||||||||||||||||
| 432 | |Qt::ItemIsDragEnabled) | - | ||||||||||||||||||||||||||||||
| 433 | { | - | ||||||||||||||||||||||||||||||
| 434 | setData(Qt::DisplayRole, text); | - | ||||||||||||||||||||||||||||||
| 435 | this->view = view; | - | ||||||||||||||||||||||||||||||
| 436 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 437 | model->insert(model->rowCount(), this); never executed: model->insert(model->rowCount(), this); | 0 | ||||||||||||||||||||||||||||||
| 438 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 439 | QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text, | - | ||||||||||||||||||||||||||||||
| 440 | QListWidget *view, int type) | - | ||||||||||||||||||||||||||||||
| 441 | : rtti(type), view(0), d(new QListWidgetItemPrivate(this)), | - | ||||||||||||||||||||||||||||||
| 442 | itemFlags(Qt::ItemIsSelectable | - | ||||||||||||||||||||||||||||||
| 443 | |Qt::ItemIsUserCheckable | - | ||||||||||||||||||||||||||||||
| 444 | |Qt::ItemIsEnabled | - | ||||||||||||||||||||||||||||||
| 445 | |Qt::ItemIsDragEnabled) | - | ||||||||||||||||||||||||||||||
| 446 | { | - | ||||||||||||||||||||||||||||||
| 447 | setData(Qt::DisplayRole, text); | - | ||||||||||||||||||||||||||||||
| 448 | setData(Qt::DecorationRole, icon); | - | ||||||||||||||||||||||||||||||
| 449 | this->view = view; | - | ||||||||||||||||||||||||||||||
| 450 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 451 | model->insert(model->rowCount(), this); never executed: model->insert(model->rowCount(), this); | 0 | ||||||||||||||||||||||||||||||
| 452 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||
| 457 | QListWidgetItem::~QListWidgetItem() | - | ||||||||||||||||||||||||||||||
| 458 | { | - | ||||||||||||||||||||||||||||||
| 459 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 460 | model->remove(this); never executed: model->remove(this); | 0 | ||||||||||||||||||||||||||||||
| 461 | delete d; | - | ||||||||||||||||||||||||||||||
| 462 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||||||||
| 467 | QListWidgetItem *QListWidgetItem::clone() const | - | ||||||||||||||||||||||||||||||
| 468 | { | - | ||||||||||||||||||||||||||||||
| 469 | return never executed: new QListWidgetItem(*this);return new QListWidgetItem(*this);never executed: return new QListWidgetItem(*this); | 0 | ||||||||||||||||||||||||||||||
| 470 | } | - | ||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||||||||
| 476 | - | |||||||||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||||||||
| 478 | void QListWidgetItem::setData(int role, const QVariant &value) | - | ||||||||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||||||||
| 480 | bool found = false; | - | ||||||||||||||||||||||||||||||
| 481 | role = (role == Qt::EditRole
| 0 | ||||||||||||||||||||||||||||||
| 482 | for (int i = 0; i < d->values.count()
| 0 | ||||||||||||||||||||||||||||||
| 483 | if (d->values.at(i).role == role
| 0 | ||||||||||||||||||||||||||||||
| 484 | if (d->values.at(i).value == value
| 0 | ||||||||||||||||||||||||||||||
| 485 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 486 | d->values[i].value = value; | - | ||||||||||||||||||||||||||||||
| 487 | found = true; | - | ||||||||||||||||||||||||||||||
| 488 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 489 | } | - | ||||||||||||||||||||||||||||||
| 490 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 491 | if (!found
| 0 | ||||||||||||||||||||||||||||||
| 492 | d->values.append(QWidgetItemData(role, value)); never executed: d->values.append(QWidgetItemData(role, value)); | 0 | ||||||||||||||||||||||||||||||
| 493 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 494 | model->itemChanged(this); never executed: model->itemChanged(this); | 0 | ||||||||||||||||||||||||||||||
| 495 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||||||||
| 503 | QVariant QListWidgetItem::data(int role) const | - | ||||||||||||||||||||||||||||||
| 504 | { | - | ||||||||||||||||||||||||||||||
| 505 | role = (role == Qt::EditRole
| 0 | ||||||||||||||||||||||||||||||
| 506 | for (int i = 0; i < d->values.count()
| 0 | ||||||||||||||||||||||||||||||
| 507 | if (d->values.at(i).role == role
| 0 | ||||||||||||||||||||||||||||||
| 508 | return never executed: d->values.at(i).value;return d->values.at(i).value;never executed: return d->values.at(i).value; | 0 | ||||||||||||||||||||||||||||||
| 509 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||
| 510 | } | - | ||||||||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||
| 516 | bool QListWidgetItem::operator<(const QListWidgetItem &other) const | - | ||||||||||||||||||||||||||||||
| 517 | { | - | ||||||||||||||||||||||||||||||
| 518 | const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole); | - | ||||||||||||||||||||||||||||||
| 519 | return never executed: QAbstractItemModelPrivate::variantLessThan(v1, v2);return QAbstractItemModelPrivate::variantLessThan(v1, v2);never executed: return QAbstractItemModelPrivate::variantLessThan(v1, v2); | 0 | ||||||||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||||||||
| 521 | void QListWidgetItem::read(QDataStream &in) | - | ||||||||||||||||||||||||||||||
| 522 | { | - | ||||||||||||||||||||||||||||||
| 523 | in >> d->values; | - | ||||||||||||||||||||||||||||||
| 524 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||||||||
| 531 | void QListWidgetItem::write(QDataStream &out) const | - | ||||||||||||||||||||||||||||||
| 532 | { | - | ||||||||||||||||||||||||||||||
| 533 | out << d->values; | - | ||||||||||||||||||||||||||||||
| 534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 535 | QListWidgetItem::QListWidgetItem(const QListWidgetItem &other) | - | ||||||||||||||||||||||||||||||
| 536 | : rtti(Type), view(0), | - | ||||||||||||||||||||||||||||||
| 537 | d(new QListWidgetItemPrivate(this)), | - | ||||||||||||||||||||||||||||||
| 538 | itemFlags(other.itemFlags) | - | ||||||||||||||||||||||||||||||
| 539 | { | - | ||||||||||||||||||||||||||||||
| 540 | d->values = other.d->values; | - | ||||||||||||||||||||||||||||||
| 541 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 542 | QListWidgetItem &QListWidgetItem::operator=(const QListWidgetItem &other) | - | ||||||||||||||||||||||||||||||
| 543 | { | - | ||||||||||||||||||||||||||||||
| 544 | d->values = other.d->values; | - | ||||||||||||||||||||||||||||||
| 545 | itemFlags = other.itemFlags; | - | ||||||||||||||||||||||||||||||
| 546 | return never executed: *this;return *this;never executed: return *this; | 0 | ||||||||||||||||||||||||||||||
| 547 | } | - | ||||||||||||||||||||||||||||||
| 548 | QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item) | - | ||||||||||||||||||||||||||||||
| 549 | { | - | ||||||||||||||||||||||||||||||
| 550 | item.write(out); | - | ||||||||||||||||||||||||||||||
| 551 | return never executed: out;return out;never executed: return out; | 0 | ||||||||||||||||||||||||||||||
| 552 | } | - | ||||||||||||||||||||||||||||||
| 553 | QDataStream &operator>>(QDataStream &in, QListWidgetItem &item) | - | ||||||||||||||||||||||||||||||
| 554 | { | - | ||||||||||||||||||||||||||||||
| 555 | item.read(in); | - | ||||||||||||||||||||||||||||||
| 556 | return never executed: in;return in;never executed: return in; | 0 | ||||||||||||||||||||||||||||||
| 557 | } | - | ||||||||||||||||||||||||||||||
| 558 | void QListWidgetItem::setFlags(Qt::ItemFlags aflags) { | - | ||||||||||||||||||||||||||||||
| 559 | itemFlags = aflags; | - | ||||||||||||||||||||||||||||||
| 560 | if (QListModel *model = (view
| 0 | ||||||||||||||||||||||||||||||
| 561 | model->itemChanged(this); never executed: model->itemChanged(this); | 0 | ||||||||||||||||||||||||||||||
| 562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 563 | void QListWidgetPrivate::setup() | - | ||||||||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||||||||
| 565 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 566 | q->QListView::setModel(new QListModel(q)); | - | ||||||||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||||||||
| 568 | QObject::connect(q, qFlagLocation("2""pressed(QModelIndex)" "\0" __FILE__ ":" "1063"), q, qFlagLocation("1""_q_emitItemPressed(QModelIndex)" "\0" __FILE__ ":" "1063")); | - | ||||||||||||||||||||||||||||||
| 569 | QObject::connect(q, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "1064"), q, qFlagLocation("1""_q_emitItemClicked(QModelIndex)" "\0" __FILE__ ":" "1064")); | - | ||||||||||||||||||||||||||||||
| 570 | QObject::connect(q, qFlagLocation("2""doubleClicked(QModelIndex)" "\0" __FILE__ ":" "1065"), | - | ||||||||||||||||||||||||||||||
| 571 | q, qFlagLocation("1""_q_emitItemDoubleClicked(QModelIndex)" "\0" __FILE__ ":" "1066")); | - | ||||||||||||||||||||||||||||||
| 572 | QObject::connect(q, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "1067"), | - | ||||||||||||||||||||||||||||||
| 573 | q, qFlagLocation("1""_q_emitItemActivated(QModelIndex)" "\0" __FILE__ ":" "1068")); | - | ||||||||||||||||||||||||||||||
| 574 | QObject::connect(q, qFlagLocation("2""entered(QModelIndex)" "\0" __FILE__ ":" "1069"), q, qFlagLocation("1""_q_emitItemEntered(QModelIndex)" "\0" __FILE__ ":" "1069")); | - | ||||||||||||||||||||||||||||||
| 575 | QObject::connect(model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1070"), | - | ||||||||||||||||||||||||||||||
| 576 | q, qFlagLocation("1""_q_emitItemChanged(QModelIndex)" "\0" __FILE__ ":" "1071")); | - | ||||||||||||||||||||||||||||||
| 577 | QObject::connect(model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1072"), | - | ||||||||||||||||||||||||||||||
| 578 | q, qFlagLocation("1""_q_dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1073")); | - | ||||||||||||||||||||||||||||||
| 579 | QObject::connect(model, qFlagLocation("2""columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "1074"), q, qFlagLocation("1""_q_sort()" "\0" __FILE__ ":" "1074")); | - | ||||||||||||||||||||||||||||||
| 580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||||||||
| 582 | void QListWidgetPrivate::_q_emitItemPressed(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 583 | { | - | ||||||||||||||||||||||||||||||
| 584 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 585 | q->itemPressed(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 586 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||||||||
| 588 | void QListWidgetPrivate::_q_emitItemClicked(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 589 | { | - | ||||||||||||||||||||||||||||||
| 590 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 591 | q->itemClicked(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 592 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||||||||
| 594 | void QListWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 595 | { | - | ||||||||||||||||||||||||||||||
| 596 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 597 | q->itemDoubleClicked(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 598 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||
| 600 | void QListWidgetPrivate::_q_emitItemActivated(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 601 | { | - | ||||||||||||||||||||||||||||||
| 602 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 603 | q->itemActivated(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 604 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||||||||
| 606 | void QListWidgetPrivate::_q_emitItemEntered(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||||||||
| 608 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 609 | q->itemEntered(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 610 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||||||||
| 612 | void QListWidgetPrivate::_q_emitItemChanged(const QModelIndex &index) | - | ||||||||||||||||||||||||||||||
| 613 | { | - | ||||||||||||||||||||||||||||||
| 614 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 615 | q->itemChanged(listModel()->at(index.row())); | - | ||||||||||||||||||||||||||||||
| 616 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||
| 618 | void QListWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex ¤t, | - | ||||||||||||||||||||||||||||||
| 619 | const QModelIndex &previous) | - | ||||||||||||||||||||||||||||||
| 620 | { | - | ||||||||||||||||||||||||||||||
| 621 | QListWidget * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 622 | QPersistentModelIndex persistentCurrent = current; | - | ||||||||||||||||||||||||||||||
| 623 | QListWidgetItem *currentItem = listModel()->at(persistentCurrent.row()); | - | ||||||||||||||||||||||||||||||
| 624 | q->currentItemChanged(currentItem, listModel()->at(previous.row())); | - | ||||||||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||||||||
| 628 | if (!persistentCurrent.isValid()
| 0 | ||||||||||||||||||||||||||||||
| 629 | currentItem = 0; | - | ||||||||||||||||||||||||||||||
| 630 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||||||||
| 632 | q->currentTextChanged(currentItem ? currentItem->text() : QString()); | - | ||||||||||||||||||||||||||||||
| 633 | q->currentRowChanged(persistentCurrent.row()); | - | ||||||||||||||||||||||||||||||
| 634 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||||||||
| 636 | void QListWidgetPrivate::_q_sort() | - | ||||||||||||||||||||||||||||||
| 637 | { | - | ||||||||||||||||||||||||||||||
| 638 | if (sortingEnabled
| 0 | ||||||||||||||||||||||||||||||
| 639 | model->sort(0, sortOrder); never executed: model->sort(0, sortOrder); | 0 | ||||||||||||||||||||||||||||||
| 640 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||||||||
| 642 | void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, | - | ||||||||||||||||||||||||||||||
| 643 | const QModelIndex &bottomRight) | - | ||||||||||||||||||||||||||||||
| 644 | { | - | ||||||||||||||||||||||||||||||
| 645 | if (sortingEnabled
| 0 | ||||||||||||||||||||||||||||||
| 646 | listModel()->ensureSorted(topLeft.column(), sortOrder, never executed: listModel()->ensureSorted(topLeft.column(), sortOrder, topLeft.row(), bottomRight.row()); | 0 | ||||||||||||||||||||||||||||||
| 647 | topLeft.row(), bottomRight.row()); never executed: listModel()->ensureSorted(topLeft.column(), sortOrder, topLeft.row(), bottomRight.row()); | 0 | ||||||||||||||||||||||||||||||
| 648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 649 | QListWidget::QListWidget(QWidget *parent) | - | ||||||||||||||||||||||||||||||
| 650 | : QListView(*new QListWidgetPrivate(), parent) | - | ||||||||||||||||||||||||||||||
| 651 | { | - | ||||||||||||||||||||||||||||||
| 652 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 653 | d->setup(); | - | ||||||||||||||||||||||||||||||
| 654 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||||||||
| 660 | QListWidget::~QListWidget() | - | ||||||||||||||||||||||||||||||
| 661 | { | - | ||||||||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||
| 668 | void QListWidget::setSelectionModel(QItemSelectionModel *selectionModel) | - | ||||||||||||||||||||||||||||||
| 669 | { | - | ||||||||||||||||||||||||||||||
| 670 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||||||||
| 672 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||||||||
| 673 | QObject::disconnect(d->selectionModel, qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1362"), | - | ||||||||||||||||||||||||||||||
| 674 | this, qFlagLocation("1""_q_emitCurrentItemChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1363")); | - | ||||||||||||||||||||||||||||||
| 675 | QObject::disconnect(d->selectionModel, qFlagLocation("2""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "1364"), | - | ||||||||||||||||||||||||||||||
| 676 | this, qFlagLocation("2""itemSelectionChanged()" "\0" __FILE__ ":" "1365")); | - | ||||||||||||||||||||||||||||||
| 677 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 678 | - | |||||||||||||||||||||||||||||||
| 679 | QListView::setSelectionModel(selectionModel); | - | ||||||||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||||||||
| 681 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||||||||
| 682 | QObject::connect(d->selectionModel, qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1371"), | - | ||||||||||||||||||||||||||||||
| 683 | this, qFlagLocation("1""_q_emitCurrentItemChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1372")); | - | ||||||||||||||||||||||||||||||
| 684 | QObject::connect(d->selectionModel, qFlagLocation("2""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "1373"), | - | ||||||||||||||||||||||||||||||
| 685 | this, qFlagLocation("2""itemSelectionChanged()" "\0" __FILE__ ":" "1374")); | - | ||||||||||||||||||||||||||||||
| 686 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 687 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 688 | QListWidgetItem *QListWidget::item(int row) const | - | ||||||||||||||||||||||||||||||
| 689 | { | - | ||||||||||||||||||||||||||||||
| 690 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 691 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||
| 692 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 693 | return never executed: d->listModel()->at(row);return d->listModel()->at(row);never executed: return d->listModel()->at(row); | 0 | ||||||||||||||||||||||||||||||
| 694 | } | - | ||||||||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||||||||
| 702 | int QListWidget::row(const QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 703 | { | - | ||||||||||||||||||||||||||||||
| 704 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 705 | return never executed: d->listModel()->index(const_cast<QListWidgetItem*>(item)).row();return d->listModel()->index(const_cast<QListWidgetItem*>(item)).row();never executed: return d->listModel()->index(const_cast<QListWidgetItem*>(item)).row(); | 0 | ||||||||||||||||||||||||||||||
| 706 | } | - | ||||||||||||||||||||||||||||||
| 707 | void QListWidget::insertItem(int row, QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 708 | { | - | ||||||||||||||||||||||||||||||
| 709 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 710 | if (item
| 0 | ||||||||||||||||||||||||||||||
| 711 | d->listModel()->insert(row, item); never executed: d->listModel()->insert(row, item); | 0 | ||||||||||||||||||||||||||||||
| 712 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 713 | void QListWidget::insertItem(int row, const QString &label) | - | ||||||||||||||||||||||||||||||
| 714 | { | - | ||||||||||||||||||||||||||||||
| 715 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 716 | d->listModel()->insert(row, new QListWidgetItem(label)); | - | ||||||||||||||||||||||||||||||
| 717 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 718 | void QListWidget::insertItems(int row, const QStringList &labels) | - | ||||||||||||||||||||||||||||||
| 719 | { | - | ||||||||||||||||||||||||||||||
| 720 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 721 | d->listModel()->insert(row, labels); | - | ||||||||||||||||||||||||||||||
| 722 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 723 | QListWidgetItem *QListWidget::takeItem(int row) | - | ||||||||||||||||||||||||||||||
| 724 | { | - | ||||||||||||||||||||||||||||||
| 725 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 726 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||
| 727 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 728 | return never executed: d->listModel()->take(row);return d->listModel()->take(row);never executed: return d->listModel()->take(row); | 0 | ||||||||||||||||||||||||||||||
| 729 | } | - | ||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||
| 736 | int QListWidget::count() const | - | ||||||||||||||||||||||||||||||
| 737 | { | - | ||||||||||||||||||||||||||||||
| 738 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 739 | return never executed: d->model->rowCount();return d->model->rowCount();never executed: return d->model->rowCount(); | 0 | ||||||||||||||||||||||||||||||
| 740 | } | - | ||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||
| 745 | QListWidgetItem *QListWidget::currentItem() const | - | ||||||||||||||||||||||||||||||
| 746 | { | - | ||||||||||||||||||||||||||||||
| 747 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 748 | return never executed: d->listModel()->at(currentIndex().row());return d->listModel()->at(currentIndex().row());never executed: return d->listModel()->at(currentIndex().row()); | 0 | ||||||||||||||||||||||||||||||
| 749 | } | - | ||||||||||||||||||||||||||||||
| 750 | void QListWidget::setCurrentItem(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 751 | { | - | ||||||||||||||||||||||||||||||
| 752 | setCurrentRow(row(item)); | - | ||||||||||||||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||||||||
| 759 | void QListWidget::setCurrentItem(QListWidgetItem *item, QItemSelectionModel::SelectionFlags command) | - | ||||||||||||||||||||||||||||||
| 760 | { | - | ||||||||||||||||||||||||||||||
| 761 | setCurrentRow(row(item), command); | - | ||||||||||||||||||||||||||||||
| 762 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 763 | int QListWidget::currentRow() const | - | ||||||||||||||||||||||||||||||
| 764 | { | - | ||||||||||||||||||||||||||||||
| 765 | return never executed: currentIndex().row();return currentIndex().row();never executed: return currentIndex().row(); | 0 | ||||||||||||||||||||||||||||||
| 766 | } | - | ||||||||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||||||||
| 768 | void QListWidget::setCurrentRow(int row) | - | ||||||||||||||||||||||||||||||
| 769 | { | - | ||||||||||||||||||||||||||||||
| 770 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 771 | QModelIndex index = d->listModel()->index(row); | - | ||||||||||||||||||||||||||||||
| 772 | if (d->selectionMode == SingleSelection
| 0 | ||||||||||||||||||||||||||||||
| 773 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); never executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); | 0 | ||||||||||||||||||||||||||||||
| 774 | else if (d->selectionMode == NoSelection
| 0 | ||||||||||||||||||||||||||||||
| 775 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); never executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | 0 | ||||||||||||||||||||||||||||||
| 776 | else | - | ||||||||||||||||||||||||||||||
| 777 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); never executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::SelectCurrent); | 0 | ||||||||||||||||||||||||||||||
| 778 | } | - | ||||||||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||||||||
| 785 | void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags command) | - | ||||||||||||||||||||||||||||||
| 786 | { | - | ||||||||||||||||||||||||||||||
| 787 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 788 | d->selectionModel->setCurrentIndex(d->listModel()->index(row), command); | - | ||||||||||||||||||||||||||||||
| 789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||||||||
| 796 | QListWidgetItem *QListWidget::itemAt(const QPoint &p) const | - | ||||||||||||||||||||||||||||||
| 797 | { | - | ||||||||||||||||||||||||||||||
| 798 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 799 | return never executed: d->listModel()->at(indexAt(p).row());return d->listModel()->at(indexAt(p).row());never executed: return d->listModel()->at(indexAt(p).row()); | 0 | ||||||||||||||||||||||||||||||
| 800 | - | |||||||||||||||||||||||||||||||
| 801 | } | - | ||||||||||||||||||||||||||||||
| 802 | QRect QListWidget::visualItemRect(const QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 803 | { | - | ||||||||||||||||||||||||||||||
| 804 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 805 | QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item)); | - | ||||||||||||||||||||||||||||||
| 806 | return never executed: visualRect(index);return visualRect(index);never executed: return visualRect(index); | 0 | ||||||||||||||||||||||||||||||
| 807 | } | - | ||||||||||||||||||||||||||||||
| 808 | - | |||||||||||||||||||||||||||||||
| 809 | - | |||||||||||||||||||||||||||||||
| 810 | - | |||||||||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||||||||
| 812 | void QListWidget::sortItems(Qt::SortOrder order) | - | ||||||||||||||||||||||||||||||
| 813 | { | - | ||||||||||||||||||||||||||||||
| 814 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 815 | d->sortOrder = order; | - | ||||||||||||||||||||||||||||||
| 816 | d->listModel()->sort(0, order); | - | ||||||||||||||||||||||||||||||
| 817 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 818 | void QListWidget::setSortingEnabled(bool enable) | - | ||||||||||||||||||||||||||||||
| 819 | { | - | ||||||||||||||||||||||||||||||
| 820 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 821 | d->sortingEnabled = enable; | - | ||||||||||||||||||||||||||||||
| 822 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||||||||
| 824 | bool QListWidget::isSortingEnabled() const | - | ||||||||||||||||||||||||||||||
| 825 | { | - | ||||||||||||||||||||||||||||||
| 826 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 827 | return never executed: d->sortingEnabled;return d->sortingEnabled;never executed: return d->sortingEnabled; | 0 | ||||||||||||||||||||||||||||||
| 828 | } | - | ||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||||||||
| 833 | Qt::SortOrder QListWidget::sortOrder() const | - | ||||||||||||||||||||||||||||||
| 834 | { | - | ||||||||||||||||||||||||||||||
| 835 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 836 | return never executed: d->sortOrder;return d->sortOrder;never executed: return d->sortOrder; | 0 | ||||||||||||||||||||||||||||||
| 837 | } | - | ||||||||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||||||||
| 841 | - | |||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||
| 843 | void QListWidget::editItem(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 844 | { | - | ||||||||||||||||||||||||||||||
| 845 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 846 | edit(d->listModel()->index(item)); | - | ||||||||||||||||||||||||||||||
| 847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||||||||
| 849 | - | |||||||||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||
| 855 | void QListWidget::openPersistentEditor(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 856 | { | - | ||||||||||||||||||||||||||||||
| 857 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 858 | QModelIndex index = d->listModel()->index(item); | - | ||||||||||||||||||||||||||||||
| 859 | QAbstractItemView::openPersistentEditor(index); | - | ||||||||||||||||||||||||||||||
| 860 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||||||||
| 864 | - | |||||||||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||||||||
| 867 | void QListWidget::closePersistentEditor(QListWidgetItem *item) | - | ||||||||||||||||||||||||||||||
| 868 | { | - | ||||||||||||||||||||||||||||||
| 869 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 870 | QModelIndex index = d->listModel()->index(item); | - | ||||||||||||||||||||||||||||||
| 871 | QAbstractItemView::closePersistentEditor(index); | - | ||||||||||||||||||||||||||||||
| 872 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 873 | QWidget *QListWidget::itemWidget(QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 874 | { | - | ||||||||||||||||||||||||||||||
| 875 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 876 | QModelIndex index = d->listModel()->index(item); | - | ||||||||||||||||||||||||||||||
| 877 | return never executed: QAbstractItemView::indexWidget(index);return QAbstractItemView::indexWidget(index);never executed: return QAbstractItemView::indexWidget(index); | 0 | ||||||||||||||||||||||||||||||
| 878 | } | - | ||||||||||||||||||||||||||||||
| 879 | void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget) | - | ||||||||||||||||||||||||||||||
| 880 | { | - | ||||||||||||||||||||||||||||||
| 881 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 882 | QModelIndex index = d->listModel()->index(item); | - | ||||||||||||||||||||||||||||||
| 883 | QAbstractItemView::setIndexWidget(index, widget); | - | ||||||||||||||||||||||||||||||
| 884 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 885 | bool QListWidget::isItemSelected(const QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 886 | { | - | ||||||||||||||||||||||||||||||
| 887 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 888 | QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item)); | - | ||||||||||||||||||||||||||||||
| 889 | return never executed: selectionModel()->isSelected(index);return selectionModel()->isSelected(index);never executed: return selectionModel()->isSelected(index); | 0 | ||||||||||||||||||||||||||||||
| 890 | } | - | ||||||||||||||||||||||||||||||
| 891 | void QListWidget::setItemSelected(const QListWidgetItem *item, bool select) | - | ||||||||||||||||||||||||||||||
| 892 | { | - | ||||||||||||||||||||||||||||||
| 893 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 894 | QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item)); | - | ||||||||||||||||||||||||||||||
| 895 | - | |||||||||||||||||||||||||||||||
| 896 | if (d->selectionMode == SingleSelection
| 0 | ||||||||||||||||||||||||||||||
| 897 | selectionModel()->select(index, select | - | ||||||||||||||||||||||||||||||
| 898 | ? QItemSelectionModel::ClearAndSelect | - | ||||||||||||||||||||||||||||||
| 899 | : QItemSelectionModel::Deselect); | - | ||||||||||||||||||||||||||||||
| 900 | } never executed: else if (d->selectionMode != NoSelectionend of block
| 0 | ||||||||||||||||||||||||||||||
| 901 | selectionModel()->select(index, select | - | ||||||||||||||||||||||||||||||
| 902 | ? QItemSelectionModel::Select | - | ||||||||||||||||||||||||||||||
| 903 | : QItemSelectionModel::Deselect); | - | ||||||||||||||||||||||||||||||
| 904 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||||||||
| 906 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||
| 909 | - | |||||||||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||||||||
| 912 | QList<QListWidgetItem*> QListWidget::selectedItems() const | - | ||||||||||||||||||||||||||||||
| 913 | { | - | ||||||||||||||||||||||||||||||
| 914 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 915 | QModelIndexList indexes = selectionModel()->selectedIndexes(); | - | ||||||||||||||||||||||||||||||
| 916 | QList<QListWidgetItem*> items; | - | ||||||||||||||||||||||||||||||
| 917 | const int numIndexes = indexes.count(); | - | ||||||||||||||||||||||||||||||
| 918 | items.reserve(numIndexes); | - | ||||||||||||||||||||||||||||||
| 919 | for (int i = 0; i < numIndexes
| 0 | ||||||||||||||||||||||||||||||
| 920 | items.append(d->listModel()->at(indexes.at(i).row())); never executed: items.append(d->listModel()->at(indexes.at(i).row())); | 0 | ||||||||||||||||||||||||||||||
| 921 | return never executed: items;return items;never executed: return items; | 0 | ||||||||||||||||||||||||||||||
| 922 | } | - | ||||||||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||||||||
| 929 | QList<QListWidgetItem*> QListWidget::findItems(const QString &text, Qt::MatchFlags flags) const | - | ||||||||||||||||||||||||||||||
| 930 | { | - | ||||||||||||||||||||||||||||||
| 931 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 932 | QModelIndexList indexes = d->listModel()->match(model()->index(0, 0, QModelIndex()), | - | ||||||||||||||||||||||||||||||
| 933 | Qt::DisplayRole, text, -1, flags); | - | ||||||||||||||||||||||||||||||
| 934 | QList<QListWidgetItem*> items; | - | ||||||||||||||||||||||||||||||
| 935 | const int indexesSize = indexes.size(); | - | ||||||||||||||||||||||||||||||
| 936 | items.reserve(indexesSize); | - | ||||||||||||||||||||||||||||||
| 937 | for (int i = 0; i < indexesSize
| 0 | ||||||||||||||||||||||||||||||
| 938 | items.append(d->listModel()->at(indexes.at(i).row())); never executed: items.append(d->listModel()->at(indexes.at(i).row())); | 0 | ||||||||||||||||||||||||||||||
| 939 | return never executed: items;return items;never executed: return items; | 0 | ||||||||||||||||||||||||||||||
| 940 | } | - | ||||||||||||||||||||||||||||||
| 941 | bool QListWidget::isItemHidden(const QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 942 | { | - | ||||||||||||||||||||||||||||||
| 943 | return never executed: isRowHidden(row(item));return isRowHidden(row(item));never executed: return isRowHidden(row(item)); | 0 | ||||||||||||||||||||||||||||||
| 944 | } | - | ||||||||||||||||||||||||||||||
| 945 | void QListWidget::setItemHidden(const QListWidgetItem *item, bool hide) | - | ||||||||||||||||||||||||||||||
| 946 | { | - | ||||||||||||||||||||||||||||||
| 947 | setRowHidden(row(item), hide); | - | ||||||||||||||||||||||||||||||
| 948 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||||||||
| 956 | void QListWidget::scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint) | - | ||||||||||||||||||||||||||||||
| 957 | { | - | ||||||||||||||||||||||||||||||
| 958 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 959 | QModelIndex index = d->listModel()->index(const_cast<QListWidgetItem*>(item)); | - | ||||||||||||||||||||||||||||||
| 960 | QListView::scrollTo(index, hint); | - | ||||||||||||||||||||||||||||||
| 961 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 962 | - | |||||||||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||
| 968 | void QListWidget::clear() | - | ||||||||||||||||||||||||||||||
| 969 | { | - | ||||||||||||||||||||||||||||||
| 970 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 971 | selectionModel()->clear(); | - | ||||||||||||||||||||||||||||||
| 972 | d->listModel()->clear(); | - | ||||||||||||||||||||||||||||||
| 973 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 974 | - | |||||||||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||||||||
| 976 | - | |||||||||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||||||||
| 981 | QStringList QListWidget::mimeTypes() const | - | ||||||||||||||||||||||||||||||
| 982 | { | - | ||||||||||||||||||||||||||||||
| 983 | return never executed: d_func()->listModel()->QAbstractListModel::mimeTypes();return d_func()->listModel()->QAbstractListModel::mimeTypes();never executed: return d_func()->listModel()->QAbstractListModel::mimeTypes(); | 0 | ||||||||||||||||||||||||||||||
| 984 | } | - | ||||||||||||||||||||||||||||||
| 985 | QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*> items) const | - | ||||||||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||||||||
| 987 | { | - | ||||||||||||||||||||||||||||||
| 988 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||
| 990 | QModelIndexList &cachedIndexes = d->listModel()->cachedIndexes; | - | ||||||||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||||||||
| 993 | if (cachedIndexes.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 994 | cachedIndexes.reserve(items.count()); | - | ||||||||||||||||||||||||||||||
| 995 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(items)>::type> _container_((items)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QListWidgetItem *item = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||||||||||||||||||||
| 996 | cachedIndexes << indexFromItem(item); never executed: cachedIndexes << indexFromItem(item); | 0 | ||||||||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||||||||
| 998 | QMimeData *result = d->listModel()->internalMimeData(); | - | ||||||||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||||||||
| 1000 | cachedIndexes.clear(); | - | ||||||||||||||||||||||||||||||
| 1001 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||||||||||||||
| 1002 | } | - | ||||||||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||||||||
| 1004 | return never executed: d->listModel()->internalMimeData();return d->listModel()->internalMimeData();never executed: return d->listModel()->internalMimeData(); | 0 | ||||||||||||||||||||||||||||||
| 1005 | } | - | ||||||||||||||||||||||||||||||
| 1006 | bool QListWidget::dropMimeData(int index, const QMimeData *data, Qt::DropAction action) | - | ||||||||||||||||||||||||||||||
| 1007 | { | - | ||||||||||||||||||||||||||||||
| 1008 | QModelIndex idx; | - | ||||||||||||||||||||||||||||||
| 1009 | int row = index; | - | ||||||||||||||||||||||||||||||
| 1010 | int column = 0; | - | ||||||||||||||||||||||||||||||
| 1011 | if (dropIndicatorPosition() == QAbstractItemView::OnItem
| 0 | ||||||||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||||||||
| 1013 | idx = model()->index(row, column); | - | ||||||||||||||||||||||||||||||
| 1014 | row = -1; | - | ||||||||||||||||||||||||||||||
| 1015 | column = -1; | - | ||||||||||||||||||||||||||||||
| 1016 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1017 | return never executed: d_func()->listModel()->QAbstractListModel::dropMimeData(data, action , row, column, idx);return d_func()->listModel()->QAbstractListModel::dropMimeData(data, action , row, column, idx);never executed: return d_func()->listModel()->QAbstractListModel::dropMimeData(data, action , row, column, idx); | 0 | ||||||||||||||||||||||||||||||
| 1018 | } | - | ||||||||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||||||||
| 1021 | void QListWidget::dropEvent(QDropEvent *event) { | - | ||||||||||||||||||||||||||||||
| 1022 | QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1023 | if (event->source() == this
| 0 | ||||||||||||||||||||||||||||||
| 1024 | QListView::dropEvent(event); | - | ||||||||||||||||||||||||||||||
| 1025 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1026 | } | - | ||||||||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||||||||
| 1028 | if (event->source() == this
| 0 | ||||||||||||||||||||||||||||||
| 1029 | dragDropMode() == QAbstractItemView::InternalMove
| 0 | ||||||||||||||||||||||||||||||
| 1030 | QModelIndex topIndex; | - | ||||||||||||||||||||||||||||||
| 1031 | int col = -1; | - | ||||||||||||||||||||||||||||||
| 1032 | int row = -1; | - | ||||||||||||||||||||||||||||||
| 1033 | if (d->dropOn(event, &row, &col, &topIndex)
| 0 | ||||||||||||||||||||||||||||||
| 1034 | QList<QModelIndex> selIndexes = selectedIndexes(); | - | ||||||||||||||||||||||||||||||
| 1035 | QList<QPersistentModelIndex> persIndexes; | - | ||||||||||||||||||||||||||||||
| 1036 | const int selIndexesCount = selIndexes.count(); | - | ||||||||||||||||||||||||||||||
| 1037 | persIndexes.reserve(selIndexesCount); | - | ||||||||||||||||||||||||||||||
| 1038 | for (int i = 0; i < selIndexesCount
| 0 | ||||||||||||||||||||||||||||||
| 1039 | persIndexes.append(selIndexes.at(i)); never executed: persIndexes.append(selIndexes.at(i)); | 0 | ||||||||||||||||||||||||||||||
| 1040 | - | |||||||||||||||||||||||||||||||
| 1041 | if (persIndexes.contains(topIndex)
| 0 | ||||||||||||||||||||||||||||||
| 1042 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1043 | std::sort(persIndexes.begin(), persIndexes.end()); | - | ||||||||||||||||||||||||||||||
| 1044 | - | |||||||||||||||||||||||||||||||
| 1045 | QPersistentModelIndex dropRow = model()->index(row, col, topIndex); | - | ||||||||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||||||||
| 1047 | int r = row == -1
| 0 | ||||||||||||||||||||||||||||||
| 1048 | for (int i = 0; i < persIndexes.count()
| 0 | ||||||||||||||||||||||||||||||
| 1049 | const QPersistentModelIndex &pIndex = persIndexes.at(i); | - | ||||||||||||||||||||||||||||||
| 1050 | d->listModel()->move(pIndex.row(), r); | - | ||||||||||||||||||||||||||||||
| 1051 | r = pIndex.row() + 1; | - | ||||||||||||||||||||||||||||||
| 1052 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||||||||
| 1054 | event->accept(); | - | ||||||||||||||||||||||||||||||
| 1055 | - | |||||||||||||||||||||||||||||||
| 1056 | event->setDropAction(Qt::CopyAction); | - | ||||||||||||||||||||||||||||||
| 1057 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1058 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||||||||
| 1060 | QListView::dropEvent(event); | - | ||||||||||||||||||||||||||||||
| 1061 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||||||||
| 1064 | - | |||||||||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||||||||
| 1068 | Qt::DropActions QListWidget::supportedDropActions() const | - | ||||||||||||||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||||||||||||||
| 1070 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1071 | return never executed: d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;never executed: return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction; | 0 | ||||||||||||||||||||||||||||||
| 1072 | } | - | ||||||||||||||||||||||||||||||
| 1073 | - | |||||||||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||||||||
| 1080 | QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const | - | ||||||||||||||||||||||||||||||
| 1081 | { | - | ||||||||||||||||||||||||||||||
| 1082 | const QListWidgetMimeData *lwd = qobject_cast<const QListWidgetMimeData*>(data); | - | ||||||||||||||||||||||||||||||
| 1083 | if (lwd
| 0 | ||||||||||||||||||||||||||||||
| 1084 | return never executed: lwd->items;return lwd->items;never executed: return lwd->items; | 0 | ||||||||||||||||||||||||||||||
| 1085 | return never executed: QList<QListWidgetItem*>();return QList<QListWidgetItem*>();never executed: return QList<QListWidgetItem*>(); | 0 | ||||||||||||||||||||||||||||||
| 1086 | } | - | ||||||||||||||||||||||||||||||
| 1087 | - | |||||||||||||||||||||||||||||||
| 1088 | - | |||||||||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||||||||
| 1091 | - | |||||||||||||||||||||||||||||||
| 1092 | QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const | - | ||||||||||||||||||||||||||||||
| 1093 | { | - | ||||||||||||||||||||||||||||||
| 1094 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1095 | return never executed: d->listModel()->index(item);return d->listModel()->index(item);never executed: return d->listModel()->index(item); | 0 | ||||||||||||||||||||||||||||||
| 1096 | } | - | ||||||||||||||||||||||||||||||
| 1097 | - | |||||||||||||||||||||||||||||||
| 1098 | - | |||||||||||||||||||||||||||||||
| 1099 | - | |||||||||||||||||||||||||||||||
| 1100 | - | |||||||||||||||||||||||||||||||
| 1101 | - | |||||||||||||||||||||||||||||||
| 1102 | QListWidgetItem *QListWidget::itemFromIndex(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||
| 1103 | { | - | ||||||||||||||||||||||||||||||
| 1104 | const QListWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1105 | if (d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||||||||
| 1106 | return never executed: d->listModel()->at(index.row());return d->listModel()->at(index.row());never executed: return d->listModel()->at(index.row()); | 0 | ||||||||||||||||||||||||||||||
| 1107 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 1108 | } | - | ||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||
| 1110 | - | |||||||||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||||||||
| 1113 | void QListWidget::setModel(QAbstractItemModel * ) | - | ||||||||||||||||||||||||||||||
| 1114 | { | - | ||||||||||||||||||||||||||||||
| 1115 | ((!(!"QListWidget::setModel() - Changing the model of the QListWidget is not allowed.")) ? qt_assert("!\"QListWidget::setModel() - Changing the model of the QListWidget is not allowed.\"",__FILE__,1964) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1116 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||||||||
| 1119 | - | |||||||||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||||||||
| 1121 | bool QListWidget::event(QEvent *e) | - | ||||||||||||||||||||||||||||||
| 1122 | { | - | ||||||||||||||||||||||||||||||
| 1123 | return never executed: QListView::event(e);return QListView::event(e);never executed: return QListView::event(e); | 0 | ||||||||||||||||||||||||||||||
| 1124 | } | - | ||||||||||||||||||||||||||||||
| 1125 | - | |||||||||||||||||||||||||||||||
| 1126 | - | |||||||||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |