MCPcopy Create free account
hub / github.com/actuallyaridan/linux-devmgmt / findDevice

Method findDevice

src/ui/MainWindow.cpp:440–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440QModelIndex 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
458void MainWindow::showProperties() {
459 auto idx = m_tree->currentIndex();

Callers

nothing calls this directly

Calls 3

rowCountMethod · 0.80
indexMethod · 0.80
deviceFieldMethod · 0.80

Tested by

no test coverage detected