| 438 | } |
| 439 | |
| 440 | QModelIndex MainWindow::findDevice(const QString &name, |
| 441 | const QString &driver) const { |
| 442 | std::function<QModelIndex(const QModelIndex &)> walk = |
| 443 | [&](const QModelIndex &parent) -> QModelIndex { |
| 444 | for (int i = 0; i < m_model->rowCount(parent); ++i) { |
| 445 | QModelIndex idx = m_model->index(i, 0, parent); |
| 446 | if (m_model->deviceField(idx, "name").toString() == name |
| 447 | && m_model->deviceField(idx, "driver").toString() == driver) |
| 448 | return idx; |
| 449 | QModelIndex found = walk(idx); |
| 450 | if (found.isValid()) |
| 451 | return found; |
| 452 | } |
| 453 | return {}; |
| 454 | }; |
| 455 | return walk(m_tree->rootIndex()); |
| 456 | } |
| 457 | |
| 458 | void MainWindow::showProperties() { |
| 459 | auto idx = m_tree->currentIndex(); |
nothing calls this directly
no test coverage detected