diff --git a/UI/item-widget-helpers.cpp b/UI/item-widget-helpers.cpp index 18a3f9ac8..b1444f933 100644 --- a/UI/item-widget-helpers.cpp +++ b/UI/item-widget-helpers.cpp @@ -37,10 +37,14 @@ void DeleteListItem(QListWidget *widget, QListWidgetItem *item) void ClearListItems(QListWidget *widget) { + // Workaround for the SceneTree workaround for QTBUG-105870 + widget->setProperty("clearing", true); + widget->setCurrentItem(nullptr, QItemSelectionModel::Clear); for (int i = 0; i < widget->count(); i++) delete widget->itemWidget(widget->item(i)); widget->clear(); + widget->setProperty("clearing", false); } diff --git a/UI/scene-tree.cpp b/UI/scene-tree.cpp index f458b8e0b..544405173 100644 --- a/UI/scene-tree.cpp +++ b/UI/scene-tree.cpp @@ -252,6 +252,7 @@ void SceneTree::rowsInserted(const QModelIndex &parent, int start, int end) void SceneTree::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { - if (selected.count() == 0 && deselected.count() > 0) + if (selected.count() == 0 && deselected.count() > 0 && + !property("clearing").toBool()) setCurrentRow(deselected.indexes().front().row()); }