Skip to content

Commit

Permalink
Add parameter for function call in QIdentityProxyModel
Browse files Browse the repository at this point in the history
This change ensures that the correct model index is passed to the sourceModel()->data() function when retrieving the DateRole value.

Pick-to: 6.8 6.5
Fixes: QTBUG-70792
Change-Id: I66c9f2404533625f05dd51db2d9263287db6ee91
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
  • Loading branch information
QtDheeru committed Oct 19, 2024
1 parent 5ac4f04 commit f0d6bfb
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class DateFormatProxyModel : public QIdentityProxyModel
if (role != Qt::DisplayRole)
return QIdentityProxyModel::data(index, role);

const QDateTime dateTime = sourceModel()->data(SourceClass::DateRole).toDateTime();
const QModelIndex sourceIndex = mapToSource(index);
const QDateTime dateTime = sourceModel()->data(sourceIndex, SourceClass::DateRole).toDateTime();
return dateTime.toString(m_formatString);
}

Expand Down

0 comments on commit f0d6bfb

Please sign in to comment.