Skip to content

Commit

Permalink
Widgets/QTreeWidget: don't emit dataChanged() with invalid indexes
Browse files Browse the repository at this point in the history
QTreeModel::itemChanged() emitted dataChanged() with an invalid index
when the given item has no columns yet.

Pick-to: 6.8 6.7 6.5
Change-Id: I8e0c67c3aae59bd6e6f8e60a2f9f968fafebfe22
Reviewed-by: David Faure <[email protected]>
  • Loading branch information
chehrlic committed Aug 10, 2024
1 parent bc93d5b commit 64bb77e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/widgets/itemviews/qtreewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ Qt::DropActions QTreeModel::supportedDropActions() const

void QTreeModel::itemChanged(QTreeWidgetItem *item)
{
if (item->columnCount() <= 0)
return;
SkipSorting skipSorting(this); //this is kind of wrong, but not doing this would kill performance
QModelIndex left = index(item, 0);
QModelIndex right = index(item, item->columnCount() - 1);
Expand Down

0 comments on commit 64bb77e

Please sign in to comment.