KDChart icon indicating copy to clipboard operation
KDChart copied to clipboard

Gantt item is not vertically centered on zoom fit with a large row height

Open arabine opened this issue 1 year ago • 0 comments

How to reproduce the bug:

  • starting with the Gantt Project example, add a "zoom fit" entry in the menu, add the zoomFit() algorithm from the Gant Legend example
  • Change the model of the project to change the row size:
    if (idx.column() == 0) {
        switch (role) {
        case Qt::SizeHintRole:
            return QSize(100, 60);

Fix:

There are two paths to update the Gantt items (which is bad). The faulty path (GraphicsScene::updateItems()) does not take in account the row size:

Replace:

item->updateItem(Span(item->pos().y(), item->rect().height()), idx);

With:

const QModelIndex sidx = summaryHandlingModel()->mapToSource(idx);
Span rg = rowController()->rowGeometry(sidx);
item->updateItem(rg, idx);

arabine avatar Aug 12 '24 11:08 arabine