call callback on the index it is called with

This commit is contained in:
Jussi Kuokkanen 2023-08-31 20:40:29 +03:00
parent b6ed9b2e7c
commit 928a031208

View File

@ -22,6 +22,9 @@ QVariant fromAssignmentArgument(TuxClocker::Device::AssignmentArgument arg) {
void traverseModel(
const ModelTraverseCallback &cb, QAbstractItemModel *model, const QModelIndex &parent) {
// Run callback on the index itself
(void) cb(model, parent.parent(), parent.row());
for (int i = 0; i < model->rowCount(parent); i++) {
auto nextOpt = cb(model, parent, i);
if (!nextOpt.has_value())