forked from qt-creator/qt-creator
Utils: Add sorted() function
For simpler calling code. Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -193,12 +193,12 @@ void SuppressionDialog::accept()
|
||||
|
||||
m_settings->suppressions.addSuppressionFile(path);
|
||||
|
||||
QModelIndexList indices = m_view->selectionModel()->selectedRows();
|
||||
Utils::sort(indices, [](const QModelIndex &l, const QModelIndex &r) {
|
||||
const QModelIndexList indices = Utils::sorted(m_view->selectionModel()->selectedRows(),
|
||||
[](const QModelIndex &l, const QModelIndex &r) {
|
||||
return l.row() > r.row();
|
||||
});
|
||||
QAbstractItemModel *model = m_view->model();
|
||||
for (const QModelIndex &index : std::as_const(indices)) {
|
||||
for (const QModelIndex &index : indices) {
|
||||
bool removed = model->removeRow(index.row());
|
||||
QTC_ASSERT(removed, qt_noop());
|
||||
Q_UNUSED(removed)
|
||||
|
||||
Reference in New Issue
Block a user