Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading usage of the enum ItemDataRole::ItemTypeRole when using QStandardItemModel::setData in KDGantt #69

Open
1molPotato opened this issue Dec 17, 2024 · 0 comments

Comments

@1molPotato
Copy link

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:

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant