StandardItem *StandardTreeModel::createNewTask(QStandardItem *root, const QString &name, bool done) { StandardItem *nameItem = new StandardItem(name, done); root->appendRow(QList<QStandardItem*>() << nameItem << nameItem->todayItem() << nameItem->totalItem()); return nameItem; }
void StandardTreeModel::calculateTotalsFor(QStandardItem *root) { if (root != invisibleRootItem()) { StandardItem *item = static_cast<StandardItem*>(root); item->todayItem()->setText(item->todaysTime()); item->totalItem()->setText(item->totalTime()); } for (int row = 0; row < root->rowCount(); ++row) calculateTotalsFor(root->child(row, 0)); }