QItemSelection selection;
QItemSelection selection; QModelIndex topLeftIndex = model->index(1, 1); QModelIndex bottomRightIndex = model->index(3, 3); QItemSelectionRange range(topLeftIndex, bottomRightIndex); selection.select(range, QItemSelectionModel::Select);
QItemSelection selection; QModelIndex index1 = model->index(1, 1); QModelIndex index2 = model->index(2, 2); QItemSelectionRange range(index1, index2); selection.select(range, QItemSelectionModel::Select); QItemSelectionModel::SelectionFlags command = QItemSelectionModel::Clear | QItemSelectionModel::Current; selection.select(QItemSelectionRange(), command);In this example, a selection is modified by clearing the current selection using the `select` method with the `Clear` flag. These examples use the Qt library, specifically the QtCore module which provides classes for core functionality.