MCPcopy Create free account
hub / github.com/KDAB/GammaRay / selectTool

Method selectTool

ui/mainwindow.cpp:426–443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426bool 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
445void MainWindow::toolSelected()
446{

Callers

nothing calls this directly

Calls 8

setCurrentIndexMethod · 0.80
isEmptyMethod · 0.45
modelMethod · 0.45
valueMethod · 0.45
matchMethod · 0.45
indexMethod · 0.45
isValidMethod · 0.45
selectionModelMethod · 0.45

Tested by

no test coverage detected