| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/itemmodels/qstringlistmodel.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - | ||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | /* | - | ||||||||||||||||||
| 41 | A simple model that uses a QStringList as its data source. | - | ||||||||||||||||||
| 42 | */ | - | ||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | #include "qstringlistmodel.h" | - | ||||||||||||||||||
| 45 | - | |||||||||||||||||||
| 46 | #include <QtCore/qvector.h> | - | ||||||||||||||||||
| 47 | - | |||||||||||||||||||
| 48 | #include <algorithm> | - | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | #ifndef QT_NO_STRINGLISTMODEL | - | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | /*! | - | ||||||||||||||||||
| 55 | \class QStringListModel | - | ||||||||||||||||||
| 56 | \inmodule QtCore | - | ||||||||||||||||||
| 57 | \brief The QStringListModel class provides a model that supplies strings to views. | - | ||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | \ingroup model-view | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | QStringListModel is an editable model that can be used for simple | - | ||||||||||||||||||
| 62 | cases where you need to display a number of strings in a view | - | ||||||||||||||||||
| 63 | widget, such as a QListView or a QComboBox. | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | The model provides all the standard functions of an editable | - | ||||||||||||||||||
| 66 | model, representing the data in the string list as a model with | - | ||||||||||||||||||
| 67 | one column and a number of rows equal to the number of items in | - | ||||||||||||||||||
| 68 | the list. | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | Model indexes corresponding to items are obtained with the | - | ||||||||||||||||||
| 71 | \l{QAbstractListModel::index()}{index()} function, and item flags | - | ||||||||||||||||||
| 72 | are obtained with flags(). Item data is read with the data() | - | ||||||||||||||||||
| 73 | function and written with setData(). The number of rows (and | - | ||||||||||||||||||
| 74 | number of items in the string list) can be found with the | - | ||||||||||||||||||
| 75 | rowCount() function. | - | ||||||||||||||||||
| 76 | - | |||||||||||||||||||
| 77 | The model can be constructed with an existing string list, or | - | ||||||||||||||||||
| 78 | strings can be set later with the setStringList() convenience | - | ||||||||||||||||||
| 79 | function. Strings can also be inserted in the usual way with the | - | ||||||||||||||||||
| 80 | insertRows() function, and removed with removeRows(). The contents | - | ||||||||||||||||||
| 81 | of the string list can be retrieved with the stringList() | - | ||||||||||||||||||
| 82 | convenience function. | - | ||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | An example usage of QStringListModel: | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | \snippet qstringlistmodel/main.cpp 0 | - | ||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | \sa QAbstractListModel, QAbstractItemModel, {Model Classes} | - | ||||||||||||||||||
| 89 | */ | - | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | /*! | - | ||||||||||||||||||
| 92 | Constructs a string list model with the given \a parent. | - | ||||||||||||||||||
| 93 | */ | - | ||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | QStringListModel::QStringListModel(QObject *parent) | - | ||||||||||||||||||
| 96 | : QAbstractListModel(parent) | - | ||||||||||||||||||
| 97 | { | - | ||||||||||||||||||
| 98 | } executed 285 times by 13 tests: end of blockExecuted by:
| 285 | ||||||||||||||||||
| 99 | - | |||||||||||||||||||
| 100 | /*! | - | ||||||||||||||||||
| 101 | Constructs a string list model containing the specified \a strings | - | ||||||||||||||||||
| 102 | with the given \a parent. | - | ||||||||||||||||||
| 103 | */ | - | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | QStringListModel::QStringListModel(const QStringList &strings, QObject *parent) | - | ||||||||||||||||||
| 106 | : QAbstractListModel(parent), lst(strings) | - | ||||||||||||||||||
| 107 | { | - | ||||||||||||||||||
| 108 | } executed 67 times by 14 tests: end of blockExecuted by:
| 67 | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | /*! | - | ||||||||||||||||||
| 111 | Returns the number of rows in the model. This value corresponds to the | - | ||||||||||||||||||
| 112 | number of items in the model's internal string list. | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | The optional \a parent argument is in most models used to specify | - | ||||||||||||||||||
| 115 | the parent of the rows to be counted. Because this is a list if a | - | ||||||||||||||||||
| 116 | valid parent is specified, the result will always be 0. | - | ||||||||||||||||||
| 117 | - | |||||||||||||||||||
| 118 | \sa insertRows(), removeRows(), QAbstractItemModel::rowCount() | - | ||||||||||||||||||
| 119 | */ | - | ||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | int QStringListModel::rowCount(const QModelIndex &parent) const | - | ||||||||||||||||||
| 122 | { | - | ||||||||||||||||||
| 123 | if (parent.isValid())
| 18-91991 | ||||||||||||||||||
| 124 | return 0; executed 18 times by 3 tests: return 0;Executed by:
| 18 | ||||||||||||||||||
| 125 | - | |||||||||||||||||||
| 126 | return lst.count(); executed 91991 times by 20 tests: return lst.count();Executed by:
| 91991 | ||||||||||||||||||
| 127 | } | - | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | /*! | - | ||||||||||||||||||
| 130 | \reimp | - | ||||||||||||||||||
| 131 | */ | - | ||||||||||||||||||
| 132 | QModelIndex QStringListModel::sibling(int row, int column, const QModelIndex &idx) const | - | ||||||||||||||||||
| 133 | { | - | ||||||||||||||||||
| 134 | if (!idx.isValid() || column != 0 || row >= lst.count())
| 0-73 | ||||||||||||||||||
| 135 | return QModelIndex(); executed 5 times by 2 tests: return QModelIndex();Executed by:
| 5 | ||||||||||||||||||
| 136 | - | |||||||||||||||||||
| 137 | return createIndex(row, 0); executed 73 times by 3 tests: return createIndex(row, 0);Executed by:
| 73 | ||||||||||||||||||
| 138 | } | - | ||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | /*! | - | ||||||||||||||||||
| 141 | Returns data for the specified \a role, from the item with the | - | ||||||||||||||||||
| 142 | given \a index. | - | ||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | If the view requests an invalid index, an invalid variant is returned. | - | ||||||||||||||||||
| 145 | - | |||||||||||||||||||
| 146 | \sa setData() | - | ||||||||||||||||||
| 147 | */ | - | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | QVariant QStringListModel::data(const QModelIndex &index, int role) const | - | ||||||||||||||||||
| 150 | { | - | ||||||||||||||||||
| 151 | if (index.row() < 0 || index.row() >= lst.size())
| 0-132335 | ||||||||||||||||||
| 152 | return QVariant(); executed 4739 times by 6 tests: return QVariant();Executed by:
| 4739 | ||||||||||||||||||
| 153 | - | |||||||||||||||||||
| 154 | if (role == Qt::DisplayRole || role == Qt::EditRole)
| 4295-112437 | ||||||||||||||||||
| 155 | return lst.at(index.row()); executed 24193 times by 17 tests: return lst.at(index.row());Executed by:
| 24193 | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | return QVariant(); executed 108142 times by 14 tests: return QVariant();Executed by:
| 108142 | ||||||||||||||||||
| 158 | } | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | /*! | - | ||||||||||||||||||
| 161 | Returns the flags for the item with the given \a index. | - | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | Valid items are enabled, selectable, editable, drag enabled and drop enabled. | - | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | \sa QAbstractItemModel::flags() | - | ||||||||||||||||||
| 166 | */ | - | ||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | Qt::ItemFlags QStringListModel::flags(const QModelIndex &index) const | - | ||||||||||||||||||
| 169 | { | - | ||||||||||||||||||
| 170 | if (!index.isValid())
| 18-10582 | ||||||||||||||||||
| 171 | return QAbstractListModel::flags(index) | Qt::ItemIsDropEnabled; executed 18 times by 3 tests: return QAbstractListModel::flags(index) | Qt::ItemIsDropEnabled;Executed by:
| 18 | ||||||||||||||||||
| 172 | - | |||||||||||||||||||
| 173 | return QAbstractListModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled; executed 10582 times by 13 tests: return QAbstractListModel::flags(index) | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;Executed by:
| 10582 | ||||||||||||||||||
| 174 | } | - | ||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | /*! | - | ||||||||||||||||||
| 177 | Sets the data for the specified \a role in the item with the given | - | ||||||||||||||||||
| 178 | \a index in the model, to the provided \a value. | - | ||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | The dataChanged() signal is emitted if the item is changed. | - | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | \sa Qt::ItemDataRole, data() | - | ||||||||||||||||||
| 183 | */ | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | bool QStringListModel::setData(const QModelIndex &index, const QVariant &value, int role) | - | ||||||||||||||||||
| 186 | { | - | ||||||||||||||||||
| 187 | if (index.row() >= 0 && index.row() < lst.size()
| 0-37 | ||||||||||||||||||
| 188 | && (role == Qt::EditRole || role == Qt::DisplayRole)) {
| 0-34 | ||||||||||||||||||
| 189 | lst.replace(index.row(), value.toString()); | - | ||||||||||||||||||
| 190 | QVector<int> roles; | - | ||||||||||||||||||
| 191 | roles.reserve(2); | - | ||||||||||||||||||
| 192 | roles.append(Qt::DisplayRole); | - | ||||||||||||||||||
| 193 | roles.append(Qt::EditRole); | - | ||||||||||||||||||
| 194 | emit dataChanged(index, index, roles); | - | ||||||||||||||||||
| 195 | // once Q_COMPILER_UNIFORM_INIT can be used, change to: | - | ||||||||||||||||||
| 196 | // emit dataChanged(index, index, {Qt::DisplayRole, Qt::EditRole}); | - | ||||||||||||||||||
| 197 | return true; executed 37 times by 4 tests: return true;Executed by:
| 37 | ||||||||||||||||||
| 198 | } | - | ||||||||||||||||||
| 199 | return false; executed 35 times by 3 tests: return false;Executed by:
| 35 | ||||||||||||||||||
| 200 | } | - | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | /*! | - | ||||||||||||||||||
| 203 | Inserts \a count rows into the model, beginning at the given \a row. | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | The \a parent index of the rows is optional and is only used for | - | ||||||||||||||||||
| 206 | consistency with QAbstractItemModel. By default, a null index is | - | ||||||||||||||||||
| 207 | specified, indicating that the rows are inserted in the top level of | - | ||||||||||||||||||
| 208 | the model. | - | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | \sa QAbstractItemModel::insertRows() | - | ||||||||||||||||||
| 211 | */ | - | ||||||||||||||||||
| 212 | - | |||||||||||||||||||
| 213 | bool QStringListModel::insertRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||
| 214 | { | - | ||||||||||||||||||
| 215 | if (count < 1 || row < 0 || row > rowCount(parent))
| 4-37 | ||||||||||||||||||
| 216 | return false; executed 24 times by 1 test: return false;Executed by:
| 24 | ||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | beginInsertRows(QModelIndex(), row, row + count - 1); | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | for (int r = 0; r < count; ++r)
| 29-140 | ||||||||||||||||||
| 221 | lst.insert(row, QString()); executed 140 times by 7 tests: lst.insert(row, QString());Executed by:
| 140 | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | endInsertRows(); | - | ||||||||||||||||||
| 224 | - | |||||||||||||||||||
| 225 | return true; executed 29 times by 7 tests: return true;Executed by:
| 29 | ||||||||||||||||||
| 226 | } | - | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | /*! | - | ||||||||||||||||||
| 229 | Removes \a count rows from the model, beginning at the given \a row. | - | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | The \a parent index of the rows is optional and is only used for | - | ||||||||||||||||||
| 232 | consistency with QAbstractItemModel. By default, a null index is | - | ||||||||||||||||||
| 233 | specified, indicating that the rows are removed in the top level of | - | ||||||||||||||||||
| 234 | the model. | - | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | \sa QAbstractItemModel::removeRows() | - | ||||||||||||||||||
| 237 | */ | - | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | bool QStringListModel::removeRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||
| 240 | { | - | ||||||||||||||||||
| 241 | if (count <= 0 || row < 0 || (row + count) > rowCount(parent))
| 6-39 | ||||||||||||||||||
| 242 | return false; executed 31 times by 2 tests: return false;Executed by:
| 31 | ||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | beginRemoveRows(QModelIndex(), row, row + count - 1); | - | ||||||||||||||||||
| 245 | - | |||||||||||||||||||
| 246 | const auto it = lst.begin() + row; | - | ||||||||||||||||||
| 247 | lst.erase(it, it + count); | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | endRemoveRows(); | - | ||||||||||||||||||
| 250 | - | |||||||||||||||||||
| 251 | return true; executed 24 times by 5 tests: return true;Executed by:
| 24 | ||||||||||||||||||
| 252 | } | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | static bool ascendingLessThan(const QPair<QString, int> &s1, const QPair<QString, int> &s2) | - | ||||||||||||||||||
| 255 | { | - | ||||||||||||||||||
| 256 | return s1.first < s2.first; executed 952 times by 2 tests: return s1.first < s2.first;Executed by:
| 952 | ||||||||||||||||||
| 257 | } | - | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | static bool decendingLessThan(const QPair<QString, int> &s1, const QPair<QString, int> &s2) | - | ||||||||||||||||||
| 260 | { | - | ||||||||||||||||||
| 261 | return s1.first > s2.first; executed 26 times by 1 test: return s1.first > s2.first;Executed by:
| 26 | ||||||||||||||||||
| 262 | } | - | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | /*! | - | ||||||||||||||||||
| 265 | \reimp | - | ||||||||||||||||||
| 266 | */ | - | ||||||||||||||||||
| 267 | void QStringListModel::sort(int, Qt::SortOrder order) | - | ||||||||||||||||||
| 268 | { | - | ||||||||||||||||||
| 269 | emit layoutAboutToBeChanged(QList<QPersistentModelIndex>(), VerticalSortHint); | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | QVector<QPair<QString, int> > list; | - | ||||||||||||||||||
| 272 | const int lstCount = lst.count(); | - | ||||||||||||||||||
| 273 | list.reserve(lstCount); | - | ||||||||||||||||||
| 274 | for (int i = 0; i < lstCount; ++i)
| 19-347 | ||||||||||||||||||
| 275 | list.append(QPair<QString, int>(lst.at(i), i)); executed 347 times by 2 tests: list.append(QPair<QString, int>(lst.at(i), i));Executed by:
| 347 | ||||||||||||||||||
| 276 | - | |||||||||||||||||||
| 277 | if (order == Qt::AscendingOrder)
| 4-15 | ||||||||||||||||||
| 278 | std::sort(list.begin(), list.end(), ascendingLessThan); executed 15 times by 2 tests: std::sort(list.begin(), list.end(), ascendingLessThan);Executed by:
| 15 | ||||||||||||||||||
| 279 | else | - | ||||||||||||||||||
| 280 | std::sort(list.begin(), list.end(), decendingLessThan); executed 4 times by 1 test: std::sort(list.begin(), list.end(), decendingLessThan);Executed by:
| 4 | ||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | lst.clear(); | - | ||||||||||||||||||
| 283 | QVector<int> forwarding(lstCount); | - | ||||||||||||||||||
| 284 | for (int i = 0; i < lstCount; ++i) {
| 19-347 | ||||||||||||||||||
| 285 | lst.append(list.at(i).first); | - | ||||||||||||||||||
| 286 | forwarding[list.at(i).second] = i; | - | ||||||||||||||||||
| 287 | } executed 347 times by 2 tests: end of blockExecuted by:
| 347 | ||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | QModelIndexList oldList = persistentIndexList(); | - | ||||||||||||||||||
| 290 | QModelIndexList newList; | - | ||||||||||||||||||
| 291 | const int numOldIndexes = oldList.count(); | - | ||||||||||||||||||
| 292 | newList.reserve(numOldIndexes); | - | ||||||||||||||||||
| 293 | for (int i = 0; i < numOldIndexes; ++i)
| 0-19 | ||||||||||||||||||
| 294 | newList.append(index(forwarding.at(oldList.at(i).row()), 0)); never executed: newList.append(index(forwarding.at(oldList.at(i).row()), 0)); | 0 | ||||||||||||||||||
| 295 | changePersistentIndexList(oldList, newList); | - | ||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | emit layoutChanged(QList<QPersistentModelIndex>(), VerticalSortHint); | - | ||||||||||||||||||
| 298 | } executed 19 times by 2 tests: end of blockExecuted by:
| 19 | ||||||||||||||||||
| 299 | - | |||||||||||||||||||
| 300 | /*! | - | ||||||||||||||||||
| 301 | Returns the string list used by the model to store data. | - | ||||||||||||||||||
| 302 | */ | - | ||||||||||||||||||
| 303 | QStringList QStringListModel::stringList() const | - | ||||||||||||||||||
| 304 | { | - | ||||||||||||||||||
| 305 | return lst; executed 1498 times by 2 tests: return lst;Executed by:
| 1498 | ||||||||||||||||||
| 306 | } | - | ||||||||||||||||||
| 307 | - | |||||||||||||||||||
| 308 | /*! | - | ||||||||||||||||||
| 309 | Sets the model's internal string list to \a strings. The model will | - | ||||||||||||||||||
| 310 | notify any attached views that its underlying data has changed. | - | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | \sa dataChanged() | - | ||||||||||||||||||
| 313 | */ | - | ||||||||||||||||||
| 314 | void QStringListModel::setStringList(const QStringList &strings) | - | ||||||||||||||||||
| 315 | { | - | ||||||||||||||||||
| 316 | beginResetModel(); | - | ||||||||||||||||||
| 317 | lst = strings; | - | ||||||||||||||||||
| 318 | endResetModel(); | - | ||||||||||||||||||
| 319 | } executed 628 times by 11 tests: end of blockExecuted by:
| 628 | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | /*! | - | ||||||||||||||||||
| 322 | \reimp | - | ||||||||||||||||||
| 323 | */ | - | ||||||||||||||||||
| 324 | Qt::DropActions QStringListModel::supportedDropActions() const | - | ||||||||||||||||||
| 325 | { | - | ||||||||||||||||||
| 326 | return QAbstractItemModel::supportedDropActions() | Qt::MoveAction; executed 19 times by 4 tests: return QAbstractItemModel::supportedDropActions() | Qt::MoveAction;Executed by:
| 19 | ||||||||||||||||||
| 327 | } | - | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | QT_END_NAMESPACE | - | ||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | #endif // QT_NO_STRINGLISTMODEL | - | ||||||||||||||||||
| Source code | Switch to Preprocessed file |