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

Method editorEvent

examples/Gantt/legend_example/entrydelegate.cpp:28–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28bool EntryDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
29{
30 if (event->type() != QEvent::MouseButtonDblClick)
31 return false;
32
33 if (!index.isValid())
34 return QItemDelegate::editorEvent(event, model, option, index);
35
36 QPointer<EntryDialog> dialog = new EntryDialog(model);
37 dialog->initFrom(index, constraintModel);
38 dialog->setWindowTitle(tr("Edit Entry"));
39 dialog->exec();
40 if (!dialog)
41 return false;
42
43 int row = index.row();
44 const QModelIndex parent = index.parent();
45 model->setData(model->index(row, 0, parent), dialog->name());
46 model->setData(model->index(row, 1, parent), dialog->type());
47 if (dialog->type() != KDGantt::TypeSummary) {
48 model->setData(model->index(row, 2, parent), dialog->startDate(), KDGantt::StartTimeRole);
49 model->setData(model->index(row, 3, parent), dialog->endDate(), KDGantt::EndTimeRole);
50 }
51 model->setData(model->index(row, 4, parent), dialog->completion());
52 model->setData(model->index(row, 5, parent), dialog->legend());
53
54 addConstraint(dialog->depends(), model->index(row, 0, parent));
55 setReadOnly(model->index(row, 0, parent), dialog->readOnly());
56
57 delete dialog;
58 return true;
59}
60
61void EntryDelegate::setReadOnly(const QModelIndex &index, bool readOnly)
62{

Callers

nothing calls this directly

Calls 14

rowMethod · 0.80
typeMethod · 0.45
isValidMethod · 0.45
initFromMethod · 0.45
parentMethod · 0.45
setDataMethod · 0.45
indexMethod · 0.45
nameMethod · 0.45
startDateMethod · 0.45
endDateMethod · 0.45
completionMethod · 0.45
legendMethod · 0.45

Tested by

no test coverage detected