MCPcopy Create free account
hub / github.com/KDAB/KDChart / initFrom

Method initFrom

examples/Gantt/legend_example/entrydialog.cpp:51–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void 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
84void EntryDialog::addDependItem(const QAbstractItemModel *model, const QModelIndex &index, int indent)
85{

Callers 1

editorEventMethod · 0.45

Calls 12

rowMethod · 0.80
constraintsForIndexMethod · 0.80
sizeMethod · 0.80
endIndexMethod · 0.80
startIndexMethod · 0.80
parentMethod · 0.45
setTextMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
flagsMethod · 0.45
isEmptyMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected