-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Description
The official API documentation for KDGantt suggests using ItemDataRole::ItemTypeRole as the role when setting the ItemType through the QStandardItemModel::setData(). However, when implementing this in practice, setting ItemType with ItemTypeRole does not work as expected and leads to rendering errors in the Gantt chart as below:
Steps to Reproduce
Open the example file <PathToKDChart>\examples\Gantt\legend_example\mainwindow.cpp and modify line 236 to:
model->setData(model->index(row, 1, parent), dialog->type(), KDGantt::ItemTypeRole);Run the example application and add any new Entry through the dialog.
branch: master(commit e1a206f)
Expected Behavior
Items with Task/Event/Summary type should be rendered correctly in the graphics scene when setting the role with KDGantt::ItemTypeRole.
Or if I misunderstood the documentation and this is a by-design behavior? If so, please provide more detailed explanation why we should assign role with other values (as far as I know, Qt::DisplayRole and Qt::EditRole work well) instead of the more semantics KDGantt::ItemTypeRole.
Actually, I found it necessary to set role as KDGantt::StartTimeRole or KDGantt::EndTimeRole when setting data for start/end time of a task item. So it's weired and apparently inconsistent if the same API is designed to be used in different ways.
