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

Method restoreExpandedState

src/ui/MainWindow.cpp:109–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void MainWindow::restoreExpandedState(const QSet<QString> &expanded) {
110 std::function<void(const QModelIndex &, int)> walk =
111 [&](const QModelIndex &parent, int depth) {
112 for (int i = 0; i < m_model->rowCount(parent); ++i) {
113 QModelIndex idx = m_model->index(i, 0, parent);
114 if (expanded.contains(
115 QString::number(depth) + ':'
116 + m_model->data(idx, Qt::DisplayRole).toString())) {
117 m_tree->expand(idx);
118 walk(idx, depth + 1);
119 }
120 }
121 };
122 walk(m_tree->rootIndex(), 0);
123}
124
125void MainWindow::onScanComplete(const QString &hostName,
126 const QVector<DeviceCategory> &categories) {

Callers

nothing calls this directly

Calls 3

rowCountMethod · 0.80
indexMethod · 0.80
dataMethod · 0.80

Tested by

no test coverage detected