QtWidgets: eradicate some indexed loops [needing qAsConst()]
... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: I9b5c23c723be024b314a7ad873e21ad63b44b348 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
parent
0574d5dc8a
commit
0f9e48d6f4
|
|
@ -3675,12 +3675,13 @@ void QFileDialogPrivate::_q_autoCompleteFileName(const QString &text)
|
|||
if (oldFiles.removeAll(idx) == 0)
|
||||
newFiles.append(idx);
|
||||
}
|
||||
for (int i = 0; i < newFiles.count(); ++i)
|
||||
select(newFiles.at(i));
|
||||
if (lineEdit()->hasFocus())
|
||||
for (int i = 0; i < oldFiles.count(); ++i)
|
||||
qFileDialogUi->listView->selectionModel()->select(oldFiles.at(i),
|
||||
QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
|
||||
for (const auto &newFile : qAsConst(newFiles))
|
||||
select(newFile);
|
||||
if (lineEdit()->hasFocus()) {
|
||||
auto *sm = qFileDialogUi->listView->selectionModel();
|
||||
for (const auto &oldFile : qAsConst(oldFiles))
|
||||
sm->select(oldFile, QItemSelectionModel::Toggle | QItemSelectionModel::Rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1847,8 +1847,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QV
|
|||
std::sort(rowsToUpdate.begin(), rowsToUpdate.end());
|
||||
QString min;
|
||||
QString max;
|
||||
for (int i = 0; i < rowsToUpdate.count(); ++i) {
|
||||
QString value = rowsToUpdate.at(i);
|
||||
for (const QString &value : qAsConst(rowsToUpdate)) {
|
||||
//##TODO is there a way to bundle signals with QString as the content of the list?
|
||||
/*if (min.isEmpty()) {
|
||||
min = value;
|
||||
|
|
|
|||
Loading…
Reference in New Issue