| 424 | } |
| 425 | |
| 426 | bool MainWindow::selectTool(const QString &id) |
| 427 | { |
| 428 | if (id.isEmpty()) |
| 429 | return false; |
| 430 | |
| 431 | const QItemSelectionModel::SelectionFlags selectionFlags = |
| 432 | QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows | QItemSelectionModel::Current; |
| 433 | const Qt::MatchFlags matchFlags = Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchWrap; |
| 434 | const QAbstractItemModel *model = ui->toolSelector->model(); |
| 435 | const QModelIndex toolIndex = |
| 436 | model->match(model->index(0, 0), ToolModelRole::ToolId, id, 1, matchFlags).value(0); |
| 437 | if (!toolIndex.isValid()) |
| 438 | return false; |
| 439 | |
| 440 | QItemSelectionModel *selectionModel = ui->toolSelector->selectionModel(); |
| 441 | selectionModel->setCurrentIndex(toolIndex, selectionFlags); |
| 442 | return true; |
| 443 | } |
| 444 | |
| 445 | void MainWindow::toolSelected() |
| 446 | { |
nothing calls this directly
no test coverage detected