| 49 | } |
| 50 | |
| 51 | void EntryDialog::initFrom(const QModelIndex &index, const KDGantt::ConstraintModel *constraintModel) |
| 52 | { |
| 53 | int row = index.row(); |
| 54 | const QModelIndex parent = index.parent(); |
| 55 | |
| 56 | ui->name->setText(model->data(model->index(row, 0, parent)).toString()); |
| 57 | ui->legend->setText(model->data(model->index(row, 5, parent)).toString()); |
| 58 | int idx = ui->type->findData(model->data(model->index(row, 1, parent)).toInt()); |
| 59 | ui->type->setCurrentIndex(idx); |
| 60 | ui->startDate->setDateTime(model->data(model->index(row, 2, parent), KDGantt::StartTimeRole).toDateTime()); |
| 61 | ui->endDate->setDateTime(model->data(model->index(row, 3, parent), KDGantt::EndTimeRole).toDateTime()); |
| 62 | ui->completion->setValue(model->data(model->index(row, 4, parent)).toInt()); |
| 63 | ui->readOnly->setChecked(!(model->flags(model->index(row, 0, parent)) & Qt::ItemIsEditable)); |
| 64 | |
| 65 | QList<KDGantt::Constraint> constraints = constraintModel->constraintsForIndex(model->index(row, 0, parent)); |
| 66 | if (constraints.isEmpty()) |
| 67 | return; |
| 68 | |
| 69 | QModelIndex constraintIndex; |
| 70 | for (int i = 0; i < constraints.size(); ++i) { |
| 71 | KDGantt::Constraint constraint = constraints[i]; |
| 72 | if (constraint.endIndex() == index) { |
| 73 | constraintIndex = constraint.startIndex(); |
| 74 | break; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if (!constraintIndex.isValid()) |
| 79 | return; |
| 80 | |
| 81 | ui->depends->setCurrentIndex(indexList.indexOf(constraintIndex) + 1); |
| 82 | } |
| 83 | |
| 84 | void EntryDialog::addDependItem(const QAbstractItemModel *model, const QModelIndex &index, int indent) |
| 85 | { |
no test coverage detected